国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

nginx虛擬主機防webshell完美版

2019-11-02 16:16:22
字體:
來源:轉載
供稿:網友

我們先來看下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;
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 修水县| 平罗县| 虹口区| 盐城市| 富平县| 九台市| 临沂市| 延边| 西藏| 雅安市| 惠东县| 菏泽市| 临安市| 金阳县| 郯城县| 家居| 浠水县| 仁寿县| 措勤县| 洞头县| 化德县| 定南县| 新营市| 乐山市| 翁源县| 象山县| 青神县| 辽阳市| 纳雍县| 介休市| 屏山县| 安图县| 牟定县| 阳江市| 藁城市| 馆陶县| 枝江市| 石狮市| 怀柔区| 全州县| 山东|