首页 >后端开发 >php教程 > nginx 配备php环境

nginx 配备php环境

WBOY
WBOY原创
2016-06-13 12:43:32934浏览

nginx 配置php环境:
nginx 配置php环境:

安装php php-fpm

cp /etc/php.ini /usr/local/php5.3.22/lib/

修改:/usr/local/php5.3.22/etc/php-fpm.conf

user = nobody

group = nobody

启动php-fpm

/usr/local/php5.3.22/sbin/php-fpm

查看是否启动了9000端口:

netstat -ntplu | grep 9000

配置nginx:

user  nobody;

worker_processes  1;

server
     {
      listen  80;
             server_name  localhost;
      location / {
             root   html;
             index  index.html index.htm index.php;
             }

      location ~ \.php$ {
            root    /usr/local/nginx/html/php;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/php$fastcgi_script_name;
            include        fastcgi_params;
        }
}

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn