我們先來看下nginx.conf
server
{ listen 80; server_name www.a.com; index index.html index.htm index.php; root /data/htdocs/www.a.com/;#limit_conn crawler 20;
location ~ .*/.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; }}
server
{ listen 80; server_name www.b.com; index index.html index.htm index.php; root /data/htdocs/www.b.com/;#limit_conn crawler 20;
location ~ .*/.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; }}
nginx在80端口接受到訪問請求后,會把請求轉發給9000端口的php-cgi進行處理
而如果修改php.ini中open_basedir= ../../../../../ ,針對兩個不同的網站,www.a.com , www.b.com都會把請求發送給9000處理,而如果先訪問www.a.com那么../../../../../就會變成A網站的根目錄地址,然后這時候如果你訪問www.b.com,那么open_basedir仍然是A網站的根目錄,但是對于B來說,又是不允許訪問的,所以就造成了,第二個站點打開以后會出現no input files,那么有什么解決辦法呢?
我們可以把不同的虛擬主機發送到不同的php-cgi端口進行處理,當然響應的php-fpm配置文件中的open_basedir也不同。。我們來看看怎么配置。。
首先,nginx.conf配置如下
server
{ listen 80; server_name www.a.com; index index.html index.htm index.php; root /data/htdocs/www.a.com/;#limit_conn crawler 20;
location ~ .*/.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; }}
server
{ listen 80;新聞熱點
疑難解答