Nginx代理转发配置

通过配置代理,可以将代理域名的所有请求转发到本地相应端口,配合frp,ngrork等内网穿透工具,可用于微信开发等场景。

https代理转发

server {
    listen 443;
    server_name frp.beilika.com;
    ssl on;
    ssl_certificate   /usr/local/nginx/cert/214697190340717.pem;
    ssl_certificate_key  /usr/local/nginx/cert/214697190340717.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_pass http://127.0.0.1:7080;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

http代理转发

server {
    listen 80;
    server_name frp.beilika.com;
    location / {
        proxy_pass http://127.0.0.1:7080;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

为您推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注