upstream www.test.com {
server 192.168.11.32:80;
server 192.168.11.42:80;
ip_hash;
}
server {
listen 80;
server_name www.test.com;
access_log /data/NVClog/access.log mylogformat;
error_log /data/NVClog/error.log notice;
if ($host = 'test.com' ) {
rewrite ^/(.*)$ http://www.test.com/$1 permanent;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
proxy_read_timeout 30s;
proxy_pass http://www.test.com;
}
}
nginx 生成环境反向代码配置
最新推荐文章于 2023-05-30 11:03:28 发布