第二十一週

配置nginx反向代理,實現api.x.com域名代理本地9001端口

一、編輯hosts文件html

192.168.43.157  api.x.com

二、編輯配置,http{}中添加配置:nginx

server {
        listen 80;
        server_name api.x.com;
        location / {
                proxy_pass http://127.0.0.1:9001/;
        }       
}

server {
    listen 9001;
    root /data/site1/api;
    location / {
        index index.html;
    }
}

三、從新加載配置:api

nginx -s reload

四、效果
第二十一週ide

相關文章
相關標籤/搜索