nginx监听端口非80时的转发问题的配置文件
程序员文章站
2024-01-22 09:23:34
...
#user nobody;
worker_processes 4;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream www.zld.com {
server 127.0.0.1:8080 weight=1;
server 127.0.0.1:8081 weight=1;
}
server {
listen 83;
server_name www.zld.com;
charset utf-8;
location / {
root html;
index index.html index.htm;
proxy_pass http://www.zld.com;
proxy_set_header Host $host:83;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
worker_processes 4;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream www.zld.com {
server 127.0.0.1:8080 weight=1;
server 127.0.0.1:8081 weight=1;
}
server {
listen 83;
server_name www.zld.com;
charset utf-8;
location / {
root html;
index index.html index.htm;
proxy_pass http://www.zld.com;
proxy_set_header Host $host:83;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
以上就介绍了 nginx监听端口非80时的转发问题的配置文件,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。