访问被拒绝WordPress的pipe理面板(Nginx / Ubuntu的)

设置: nginx / 1.4.6,Ubuntu / 14.04.3 LTS,Wordpress / 4.5.4

我从一个子目录运行Wordpress(在本文后面: 使用预先存在的子目录安装 ),我发现使网站工作的唯一方法是将此作为我的nginxconfiguration的一部分:

location / { try_files $uri /wordpress$uri/ /wordpress/index.php?$args; } 

…但有了它,我无法访问pipe理面板 。 与其他nginxconfiguration我看到的HTML内容,但我得到了404的每个外部资产(CSS,图像,JS等)。

我尝试了许多不同的configuration,没有任何结果在这个职位(等等)之后:

  • Nginxconfiguration – 我无法访问WordPresspipe理区域
  • Nginx的 – 在一个子目录中的wordpress,应该传递什么数据?

当前的nginxconfiguration:

 server { listen 80; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php; server_name mysite.com; location / { #try_files $uri $uri/ /index.php?$args; #try_files $uri /wordpress$uri/ /wordpress/index.php?$args; } location /wordpress { try_files $uri $uri/ /wordpress/index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } } 

这里是我用于在“博客”子目录中运行wordpress的位置设置。 more_clear_headers需要将正确的模块编译成Nginx。

 location / { # If the file can't be found try adding a slash on the end - it might be # a directory the client is looking for. Then try the WordPress blog URL # this might send a few requests to PHP that don't need to go that way try_files $uri $uri/ /blog/index.php?$args; more_clear_headers Server; more_clear_headers "Pragma"; more_clear_headers "Expires"; } 

这部分是有帮助的

 # Add trailing slash to */wp-admin requests. rewrite /blog/wp-admin$ $scheme://$host$uri/ permanent; 

这对于大多数人来说不是必需的,但是我为非pipe理页面更改了一堆头文件,所以这确保了默认头文件被传递。

 # WordPress admin caching headers are set correctly, for pages and resources. The only reason we define # this block separately is to avoid messing with the headers in the main php block. # This is probably unnecessary because of the skip_cache variable and may be removed location ~* wp-admin { fastcgi_keep_conn on; fastcgi_pass php56-fpm; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; } 

我有一个WordPress的/ Nginx的教程,你可能会觉得有用。 它包括你可以下载的configuration文件,虽然我不认为我实际上包含在一个子目录中的这种模式的Wordpress – 不是100%确定。