nginx 分離配置文件 conf.d和default.conf


1. 在 nginx.conf 文件中引用 conf.d 下的所有配置文件

#在http配置節的末尾添加配置引用
http {
    ...

    #gzip  on;

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

2. 在 conf.d 中添加 default.conf 配置文件

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
    
    #代理配置
    location /business {
        proxy_pass  http://business.app.com;
    }
    
    #代理配置
    location /user {
        proxy_pass  http://user.app.com;
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM