nginx配置网站不用conf.d目录

岁月如歌 2020-04-25

nginx配置网站不用conf.d目录

yum install nginx php-fpm -y
systemctl   start nginx
systemctl   enable nginx
systemctl   start php-fpm
systemctl   enable nginx

cd /etc/nginx
mv nginx.conf   nginx.conf.bak
grep -Ev  ‘^$|#‘   /etc/nginx/nginx.conf.default   >/etc/nginx.conf

-rw-r--r-- 1 root root 3610 Mar  6  2018 win-utf
[ /]# cat /etc/nginx/nginx.conf
worker_processes  1;
user www;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
            root   /code/upload;
            index  index.html index.htm index.php;
location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

    }
}

location 哪里怎么看:
cat  /etc/nginx/nginx.default   里面有

useradd   www
vim /etc/php-fpm.d/www.conf
把里面的user与group改成www用户

nginx  -t检测
systemctl restart nginx
systemctl restart php-fpm

mkdir -p /code
程序源码放进去
chown  -R www.www   /code

最后重启nginx与php-fpm

相关推荐

lwplvx / 0评论 2020-11-22
岁月如歌 / 0评论 2020-07-21