2015-11-05 122 views
1

另一台服务器最近,我决定给Nginx的一个液滴一试,但我仍然需要在路径http://tld.com/guides proxy_pass到另一个Apache的液滴托管WordPress的Nginx的proxy_pass托管WordPress的

这里是我的ProxyPass的conf:

location /guides { 
    rewrite ^/guides/(.*)$ /$1 break; 

    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $remote_addr; 
    proxy_set_header Host $host; 
    proxy_pass http://droplet_private_ip:80; 
    proxy_redirect off; 
} 

的这是Nginx的是所有的WordPress的PHP文件重定向到FPM,我认为这是由于这种

location ~ \.php$ { 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 

    # With php5-cgi alone: 
    #fastcgi_pass 127.0.0.1:9000; 
    # With php5-fpm: 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    fastcgi_index index.php; 
    include fastcgi_params; 
    } 

是否有一个排除所有来自/指南的请求是否被本地fpm执行?

回答

0

我修复了它。以防万一有人遇到同样的问题。这个固定我的问题

location ~* ^((?!\/guides)(.+)\.php)$ { 
      fastcgi_split_path_info ^(.+\.php)(/.+)$; 
      # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 

      # With php5-cgi alone: 
      #fastcgi_pass 127.0.0.1:9000; 
      # With php5-fpm: 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      include fastcgi_params; 
    } 

这部分正是

location ~* ^((?!\/guides)(.+)\.php)$ { 

它确保从/指南所有.php文件不被FPM handeled