用NGINX作为代理服务器的WordPress:无法访问wp-admin(502坏门禁)

我有一个Django项目和一个WordPress博客的服务器,我使用Nginx从本地端口(8001为GUnicorn和8081为Apache服务)

我为我的WordPress站点设置了以下Nginx文件,但是我只能访问主页。 所有其他的网页是502.我不明白我想念什么!

Nginx:Nginx.conf

worker_processes 1; events { worker_connections 1024; } http { sendfile on; gzip on; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 500; gzip_disable "MSIE [1-6]\."; gzip_types text/plain text/xml text/css text/comma-separated-values text/javascript application/x-javascript application/atom+xml; # Configuration for Nginx server_names_hash_bucket_size 64; server { return 404; } include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } 

wordpress.conf

 # WordPress single site rules. # Designed to be included in any server {} block. # Upstream to abstract backend connection(s) for php upstream php { #server unix:/tmp/php-cgi.socket; server 127.0.0.1:8081; } server { ## Your website name goes here. server_name www.simple-ripple.com simple-ripple.com; ## Your only path reference. root /var/www; ## This should be in your http block and if it is, it's not needed here. index index.php; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { # This is cool because no php is touched for static content. # include the "?$args" part so non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?q=$uri$args; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; include proxy_params; proxy_pass http://127.0.0.1:8081; } location ~ \.php$ { #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini #fastcgi_split_path_info ^(/wp)(/.*)$; include fastcgi.conf; fastcgi_intercept_errors on; fastcgi_pass php; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; } #location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { # expires max; # log_not_found off; #} } 

为了扩展我对你的问题的评论,请在wordpress和php-fpm下为你的虚拟主机使用类似的configuration

 location / { index index.php index.html; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass_header Set-Cookie; fastcgi_pass_header Cookie; fastcgi_ignore_headers Cache-Control Expires Set-Cookie; fastcgi_pass YOURBACKEND; fastcgi_index index.php; include fastcgi.conf; }