久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      配置Nginx目錄別名Alias支持PHP解析

      關(guān)于Nginx配置基礎(chǔ)知識,PHP用FastCGI,在Apache里,有alias,比較方便,在Nginx下沒有虛擬目錄概念的,是用location配合alias使用,但使用alias標(biāo)簽的目錄塊中不能使用rewrite的break。

      一、例子說明:

      1)我的環(huán)境是:web根目錄在 /var/www/html/中,但是我要加上一個(gè)類似于apache的別名目錄 /bbs ,此目錄不在 web根目錄中。
      我的配置文件如下:

      server {
          listen      80;
          server_name    localhost;
          default_type text/plain;
          location / {
              root    /var/www/html;
              index    index.php index.htm index.html;
          }
          location /bbs {
              alias /opt/bbs;
              index index.html index.htm index.php;
          }
          location ~ ^/bbs/.+.php$ {
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param SCRIPT_FILENAME /opt$fastcgi_script_name;
              include        fastcgi_params;
              #include fastcgi.conf;
          }
        location ~ .php$ {
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
              include        fastcgi_params;
              #include fastcgi.conf;
          }
      }

      說明: 上面這個(gè)就是成功的例子。

      二、但是又如下幾點(diǎn)需要注意:

      1)location ~ .php$ {}  段,必須放在 location ~ ^/bbs/.+.php$ {} 段后面,否則/bbs/的url打不開
      2) location ~ ^/bbs/.+.php$ {} 里面也可以寫成如下:

      location ~ ^/bbs/.+.php$ {
              root /opt;
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include        fastcgi_params;
          }

      也就是用變量名 $document_root 代替 /opt; 其實(shí)每個(gè) location {}中的 $document_root 都是局部變量,都是在本段配置 root指令指定的路徑。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號