我安装了WordPressthat works perfectly on a Apache server. 我目前正在改变我的托管公司(新的一家提供NGinx)和我的开发堆栈(转移到vvv)。
Here is how the install is set-up:
它是一个Wordpress子域多站点安装,核心在一个子文件夹(/wp-app/)中,wp内容在另一个子文件夹(/wp-app-content/)中,当然还有我的索引。php,wp配置。php和。根文件夹中的htaccess以及这两个文件夹。Here is my problem :
在生产版本(apache)上,管理员工作正常,/wp app/文件夹完全隐藏。在开发版本(NGinx)上,管理员部分工作,但许多页面返回404,有时WP会使用WP app重写url。
What I think is the source of the problem :
我几乎可以肯定我的NGinx重写不好。我发现有几个feed提到了这个问题,但他们要么没有回答,要么回答不完整,对我不起作用。
My .htaccess file that works :
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) wp-app/$1 [L]
RewriteRule ^(.*\\.php)$ wp-app/$1 [L]
RewriteRule . index.php [L]
# END WordPress
My nginx.conf that partially works :server {
listen 80;
listen 443 ssl;
server_name guillaumemolter.dv *.guillaumemolter.dv
root /srv/www/guillaumemolter/htdocs;
index index.php;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ last;
rewrite ^/(wp-.*.php)$ /wp-app/$1 last;
rewrite ^/(wp-(content|admin|includes).*) /wp-app/$1 last;
}
location / {
#try_files $uri $uri/ /wp-app/index.php?$args ;
try_files $uri $uri/ /index.php?$args ;
}
location ~ \\.php$ {
#try_files /wp-app/$uri =404;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
location ~* ^.+\\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\\. { deny all; access_log off; log_not_found off; }
}
这两行注释是我出于绝望而做的测试。。。。Resources I read and used so far:
https://codex.wordpress.org/Nginxhttps://rtcamp.com/wordpress-nginx/tutorials/multisite/还有其他一些,包括来自这个网站的2个feed,我不能在这里发布,因为我没有足够的声誉。非常感谢你的帮助。