首页 专题 文章 代码 归档

【日记】Nginx反向代理设置

1. 备忘

简单的一个备忘:

简单的一个反向代理设置:


 log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

server {

    listen       80;
    listen       443 ssl http2;
    server_name  s.lzpan.com;

    #charset koi8-r;

    ssl_certificate /root/.acme.sh/s.lzpan.com/fullchain.cer;
    ssl_certificate_key  /root/.acme.sh/s.lzpan.com/s.lzpan.com.key;

    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    access_log  logs/s.lzpan.com.access.log  main;
    location / {
        proxy_pass http://localhost:4050/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
此文阅读完毕,您可以:分享
二维码图片 扫描关注我们哟