nginx 端口转发规则

14324472932024-10-18linux运维73

server {
 listen 80;
 listen [::]:80;
 server_name *.lovekf.cn;
 location / {
 proxy_pass http://127.0.0.1:81;
 proxy_redirect http://$host/ http://$http_host/;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $host;
 }
}
server {
 listen 443 ssl http2;
 listen [::]:443 ssl http2;
 server_name *.lovekf.cn;
 ssl_certificate    /www/server/panel/vhost/cert/lovekf.cn/fullchain.pem;
 ssl_certificate_key    /www/server/panel/vhost/cert/lovekf.cn/privkey.pem;
 client_max_body_size 50m; 
 client_body_buffer_size 256k;
 client_header_timeout 3m;
 client_body_timeout 3m;
 send_timeout 3m;
 proxy_connect_timeout 300s; 
 proxy_read_timeout 300s; 
 proxy_send_timeout 300s;
 proxy_buffer_size 64k; 
 proxy_buffers 4 32k; 
 proxy_busy_buffers_size 64k;
 proxy_temp_file_write_size 64k; 
 proxy_ignore_client_abort on; 
 location / {
 proxy_pass http://127.0.0.1:81;
 proxy_redirect https://$host/ https://$http_host/;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_ssl_server_name on;
 proxy_set_header Host $host;
 }
}

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。