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

2021-03-18 10:24

阅读:318

标签:types   fast   local   event   server   emctl   params   list   http   

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
[root@oldboy /]# 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

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

标签:types   fast   local   event   server   emctl   params   list   http   

原文地址:https://www.cnblogs.com/zuoxiaodragon/p/12773429.html


评论


亲,登录后才可以留言!