nginx 反向代理

upstream webfenxi {
server 127.0.0.1:8081;
}

    location / {
            proxy_set_header X-Real-Ip $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

            proxy_set_header X-Nginx-Proxy true;
            proxy_pass http://webfenxi;
            proxy_redirect off;
           # try_files $uri $uri/ /index.html;
    }

server
{
listen 80;
#listen [::]:80;
server_name www.webfenxi.com api.webfenxi.com;
index index.html index.htm index.php default.html default.htm default.php;
#root /home/wwwroot/webfenxi.com;

    include none.conf;
    #error_page   404   /404.html;

    # Deny access to PHP files in specific directory
    #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

    include enable-php.conf;

    location / {
            proxy_set_header X-Real-Ip $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

            proxy_set_header X-Nginx-Proxy true;
            proxy_pass http://webfenxi;
            proxy_redirect off;
           # try_files $uri $uri/ /index.html;
    }


    location ~ /.well-known {
        allow all;
    }

    location ~ /\.
    {
        deny all;
    }
    access_log  /home/wwwlogs/webfenxi.com.log;
}

本文系作者 @ 原创发布在 王树东的博客。未经许可,禁止转载。

喜欢()
评论 (2)
  • 头像
    stark

    天气不错

    回复
  • 头像
    MuYu

    这个最近有刚用到,node起的web服务监听3000端口,然后用ng做代理。才明白反向代理干嘛使得

    回复
热门搜索
Top