server {
listen 80;
server_name xxx1.com xxx2.com localhost;
root /opt/dist/;
charset UTF-8;
autoindex off;
access_log /opt/nginx-log/access.log;
location / {
try_files $uri @backend;
autoindex off;
}
location @backend {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect http://localhost http://$host:$server_port;
proxy_redirect http://xxx1.com http://$host:$server_port;
proxy_set_header Host $http_host;
proxy_pass http://localhost:9012;
}
}