整合 nginx與php配置

來源:互聯網
上載者:User

標籤:nginx   php   

     nginx本身並不處理動態請求,它會通過fastcgi把請求轉寄給php,php處理完產生靜態頁面再由nginx處理。

      PHP-FPM也是一個第三方的FastCGI進程管理器,它是作為PHP的一個補丁來開發的,在安裝的時候也需要和PHP源碼一起編譯,也就是說PHP-FPM被編譯到PHP核心中,因此在處理效能方面更加優秀;同時它在處理高並發方面也比spawn-fcgi引擎好很多,因此,推薦Nginx+PHP/PHP-FPM這個組合對PHP進行解析,php5.3以上版本已經將php-FPM整合到php安裝包裡面了,php5.2及以下需要下載擴充包http://php-fpm.org/downloads/。


server{

server_namewww.mysite2.name;

return301 $scheme://mysite2.name$request_uri;

}

server{

server_name    mysite2.name;


root/usr/share/nginx/mysite2.name/live/;

indexindex.html index.htm index.php;


location/ {

try_files$uri $uri/ /index.html index.php;

}


location~ \.php$ {

fastcgi_split_path_info^(.+\.php)(/.+)$;

fastcgi_passunix:/var/run/php5-fpm.sock;

fastcgi_indexindex.php;

includefastcgi_params;

}

}


整合 nginx與php配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.