当我们需要部署俩个以上的history模式的项目时,可以建立多个server,配置如下:
server {
listen 7777;
#this line shoud be include in every server block
include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf;
location = / {
root html;
index index.html index.htm;
}
location / {
try_files $uri $uri/ /www_ssp_web/index.html;
}
}
server {
listen 6666;
include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf;
location = / {
root html;
index index.html index.htm;
}
location / {
try_files $uri $uri/ /www_dsp_web/index.html;
}
}
然后分别访问:
192.168.1.10:7777/login
192.168.1.10:6666/login