ngnix多个代理和子域名配置
ngnix的配置文件目录
├── conf.d
│ └── airflow.conf
├── default.d
├── fastcgi.conf
├── fastcgi.conf.default
├── fastcgi_params
├── fastcgi_params.default
├── koi-utf
├── koi-win
├── mime.types
├── mime.types.default
├── nginx.conf
├── nginx.conf.default
├── scgi_params
├── scgi_params.default
├── uwsgi_params
├── uwsgi_params.default
└── win-utf
- nginx.conf为主配置文件,若有配置可往主配置文件配置也可往专门的conf.d中配置,次配置文件名必须以.conf结尾
- conf.d中的文件配置示例如下
[root@node1 ~]# cd /etc/nginx/conf.d
[root@node1 conf.d]# vim reverse_proxy.conf
server
{
listen 81;
server_name jira.51cto.com;
location / {
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.1.101:8080;
}
access_log /var/log/nginx/jira-51cto-com.log;
}