Discuss New Concept,New Technic,New Tools, Including EAI,BPM,SOA,Tibco,IBM MQ,Tuxedo, Cloud,Hadoop,NoSQL,J2EE,Ruby,Scala,Python, Performance,Scalability,Distributed,HA, Social Network,Machine Learning.

Centos

Jan 092013
 
 [repost ]centos+nginx+php配置简介  January 9, 2013  Posted by on January 9, 2013 at 11:35 pm Centos, Nginx, PHP-Other, Web Server Tagged with: , ,  No Responses »

original:http://www.phptogether.com/archives/10037/comment-page-1 nginx默认是不能解析PHP的,要解析PHP需要修改nginx的配置文件。 打开nginx.conf, 找到location / 修改如下: location / { root   /var/www; index  index.php index.html index.htm; } 找到location ~ .php$,修改如下: location ~ .php$ { root           /var/www; fastcgi_pass   127.0.0.1:9001; fastcgi_index  index.php; fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name; include        fastcgi_params; } root:设置PHP脚本的根目录 fastcgi_pass:处理PHP脚本的端口,这里监听9001 fastcgi_index :索引文件 fastcgi_param:php脚本路径 设置完之后,还需要配置php-fpm.conf,进入你的php安装目录下的etc文件夹,将php-fpm.conf.default重命名为php-fpm.conf,双击打开,修改listen为9001。 启动终端,cd进入php安装目录的sbin文件夹,使用./php-fpm命令启动fpm,如果启动报错,打开php-fpm.conf,去掉如下语句前的注视,然后重启php-fpm pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 配置nginx和php-fpm开机自启动: [...]