nginx+php-fpm动静分离
生活随笔
收集整理的這篇文章主要介紹了
nginx+php-fpm动静分离
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
純粹筆記整理,非原創
關鍵配置
1、nginx.conf:
upstream?phpCluster{server?web-php1.life.com:9000;server?web-php2.life.com:9000; } server?{listen???????8080;server_name??nginx.life.com;index?index.php?index.html?index.htm;root??/home/nginx/html;charset??utf-8;location?~?.*\.(php|php5)?{??????fastcgi_pass??phpCluster;fastcgi_index?index.php;include?fastcgi.conf;??set?$path_info?"";set?$real_script_name?$fastcgi_script_name;if?($fastcgi_script_name?~?"^(.+?\.php)(/.+)$")?{set?$real_script_name?$1;set?$path_info?$2;}fastcgi_param?SCRIPT_FILENAME?$document_root$real_script_name;fastcgi_param?SCRIPT_NAME?$real_script_name;fastcgi_param?PATH_INFO?$path_info;} }2、php-fpm.conf
listen?=?0.0.0.0:9000 listen.allowed_clients?=?10.0.2.11,10.0.2.12,127.0.0.1 request_terminate_timeout?=?60s3、網站根目錄
nginx服務器與php服務器的根目錄要一致,并且需要賦予相應的權限
nginx:root ?/home/nginx/html;
php:
[php@web-php1?~]$?ll total?12 drwxrwxr-x?2?php?php?4096?Dec?30?16:04?crontab drwxrwxr-x?3?php?php?4096?Dec?30?16:04?data lrwxrwxrwx?1?php?php???17?Dec?30?16:07?html?->?/home/nginx/html/ drwxr-xr-x?9?php?php?4096?Dec?30?16:01?php轉載于:https://blog.51cto.com/fenghq/1888853
總結
以上是生活随笔為你收集整理的nginx+php-fpm动静分离的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux设备驱动归纳总结(四):1.进
- 下一篇: “极致”神话和产品观念_转自“蜗窝科技”