baker95935

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

nginx1.10.2

1先检查 /etc/nginx/nginx.conf 是否include  conf.d

include /etc/nginx/conf.d/*.conf;

默认都是包含的,如果没有把代码加上,如果有继续第二步

2 来到conf.d文件夹

vim nginx.6328.net.conf

把一下代码添加

server
{
    listen         80;
    server_name    nginx.6328.net;

    location ~ ^/NginxStatus/ {
    stub_status on;
    access_log off;
    }



    location / {
         root    /var/www/nginx/public;
         index  index.php index.html index.htm;
    }




      location ~ .php$ {

        root           /var/www/nginx/public;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  /var/www/nginx/public$fastcgi_script_name;

        include        fastcgi_params;

    }



}

一定要注意 

fastcgi_param  SCRIPT_FILENAME  /var/www/nginx/public$fastcgi_script_name;  路径要和配置的域名访问的目录一致

3 保存 重启nginx

使用域名访问即可生效
service nginx stop
service nginx start

 

 
posted on 2017-07-26 14:47  baker95935  阅读(2071)  评论(0编辑  收藏  举报