码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2020-04-25 17:00:26      阅读:141      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!