美文网首页
mac local web ngnix proxy

mac local web ngnix proxy

作者: 空天啸鹤 | 来源:发表于2020-03-19 18:27 被阅读0次

    代理本地website步骤:

    1.写入hosts,才能将请求发到本地:

    sudo vi /etc/hosts
    

    2.配置vhost ngnix xxxxx.conf:

    server {
        listen 80;
        server_name xxx.xxx.com;
        set $node_port 8081;
        location ~* /{
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_pass http://127.0.0.1:$node_port$request_uri;
            proxy_redirect off;
        }
    }
    

    3.运行ngnix:

    ngnix -s stop
    ngnix
    ps -ef|grep ngnix
    

    相关文章

      网友评论

          本文标题:mac local web ngnix proxy

          本文链接:https://www.haomeiwen.com/subject/zxalyhtx.html