centos配置nginx php,centosnginxphp


yum list nginx* 查看nginx的安装包
yum install nginx 安装nginx
service nginx restart 重启nginx
yum install php-fpm安装对应版本的php-fpm
cd /etc/nginx/conf.d 到nginx的配置文件

server {
    listen       8080;
    #listen       [::]:8080 default_server;
    server_name  spc.shellfly.com;#配置域名
   #root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
      index index.php index.html index.htm;
    }
    location ~ \.php$ {
                       root /var/www; #指定php的根目录
                        fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

}

然后重启nginx访问网址就可以看到信息了
参考:http://blog.csdn.net/zjiang1994/article/details/72876193
参考:https://blog.toright.com/posts/3890/%e7%84%a1%e5%a0%85%e4%b8%8d%e6%91%a7%ef%bc%8c%e5%94%af%e5%bf%ab%e4%b8%8d%e7%a0%b4%ef%bc%81%e5%bf%ab%e6%94%b9%e7%94%a8-nginx-php-fpm-%e5%8f%96%e4%bb%a3-apache-%e5%90%a7%ef%bc%81.html

相关内容

    暂无相关文章