nginx URL 具有上下文(虚拟)路径
ngnix URL with context(virtual) path
我的 ngix 站点配置文件如下。我想将上下文路径添加到我的 URL
我可以通过http://localhost:8888, but I want to add context path to my site URL like http://localhost:8888/MyApp
访问网站
server {
listen 8888;
server_name localhost;
location{
root "C:/nginx/Share/dist";
index index.html index.htm;
}
}
提前致谢
您需要为此更改基准位置
server {
listen 8888;
server_name localhost;
location / {
# since we have nothing on root we can redirect to /MyApp/ if we want
return 302 /MyApp;
}
location /MyApp {
root "C:/nginx/Share/dist";
index index.html index.htm;
}
}
我的 ngix 站点配置文件如下。我想将上下文路径添加到我的 URL
我可以通过http://localhost:8888, but I want to add context path to my site URL like http://localhost:8888/MyApp
访问网站server {
listen 8888;
server_name localhost;
location{
root "C:/nginx/Share/dist";
index index.html index.htm;
}
}
提前致谢
您需要为此更改基准位置
server {
listen 8888;
server_name localhost;
location / {
# since we have nothing on root we can redirect to /MyApp/ if we want
return 302 /MyApp;
}
location /MyApp {
root "C:/nginx/Share/dist";
index index.html index.htm;
}
}