想问一下在二级子目录下的Wordpress怎么配置伪静态
wordpress装在xxx.xxx.xxx.xxx/wordpress目录下直接在写了下面这个配置,不成功,请教一下lnmp应该怎么配置这个。
location /wordpress/ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /wordpress/index.php;
}
} 把配置文件include到nginx.conf之后,,显示nginx: "location" directive is not allowed here in /usr/local/nginx/conf/wp2.conf:1 贴配置,位置应该是不对 就是把wordpress装在/wwwroot/wordpress目录后,一直没有成功配置好伪静态页面。 看网上的教程说,把这个 wp.conf 包含在相应站点的 nginx 配置文件中,就可以实现二级目录建WP站的伪静态。
应该怎么包含进去? 在服务器安装了LNMP,如果想在 weidao.net/wordpress/ 类似的目录下,再安装一个WP博客,那原来的 nginx 伪静态规则就不行了,那只对根目录有效,还得配置二级子目录的nginx 伪静态规则,如下:
location /wordpress/ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /wordpress/index.php;
}
}
把上面的内容写到一个文件,如 wp.conf,然后把这个 wp.conf 包含在相应站点的 nginx 配置文件中,就可以实现二级目录建WP站的伪静态。
可以用命令 /usr/local/nginx/sbin/nginx -t 测试一下,nginx 配置文件是否有错。 但是不太清楚怎么include到nginx配置中去 是放到 nginx.conf 的server{}中么? 感谢军哥,已经搞定,的确是放到server{}当中 楼主怎样做的,我现在情况是,根目录安装wp博客,xxx.com安装wp博客程序;然后xxx.com/bbs目录下安装DZ,现在我的情况是把nginx.conf配置文件做了500,防止把其他域名挂靠到这个网站上。这种情况,怎么配置一下DZ的伪静态。楼主能否贴一下你的完全的配置文件。
页:
[1]