2015-11-05 126 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