1.首先在nginx的html目录下创两个文件夹分别用于放两个前端打包好的静态资源,并且把静态资源各自放好:
2. 在nginx的配置文件里,写好两个server。如图,写好两个前端要用的端口以及刚才那两文件夹的路径:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 8081;
server_name localhost;
location / {
root html/manage;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8082;
server_name localhost;
location / {
root html/client;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
3. 再双击一下nginx.exe就可以了: