- 在 nginx.conf 文件中引用 conf.d 下的所有配置文件
#在http配置节的末尾添加配置引用
http {
...
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
- 在 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;
}
}