nginx 代理两套前端,后端是一个 配置

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

第一个前端项目

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

第二个前端项目
location /项目名称 {
root html/项目名称 ;
index index.html index.htm;
}

接口代理到后台
location /后台ws {
proxy_pass http://域名/ws;
}

接下来就是nginx命令了,

这里命令使用非常简单,三个命令足以。

完的nginx是双击一下闪退,进不去,所以我就用cmd

 进入到nginx目录,

启动nginx:start nginx.exe

修改配置后:nginx.exe -s reload

停用nginx:nginx.exe -s stop  或者  nginx.exe -s quit

注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息
然后输入相应的地址,就可以啦!

原文地址:https://www.cnblogs.com/zhoujuan/p/11541824.html