使用Nginx做反向代理的配置

安装Nginx服务之后 修改Nginx配置文件

如下server字段中主要是配置listen监听8080 端口,然后静态文件袋里到8001  后端端口代理到8000 

server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
        #   root   html;
        #    index  index.html index.htm;
        #    
        #}

        location / {
            proxy_pass http://localhost:8001;
        }
        location /api/ {
            proxy_pass http://localhost:8000;
            proxy_set_header Host $host;
        }
原文地址:https://www.cnblogs.com/qqfontofweb/p/13682207.html