1

我的 ngix 站点配置文件如下所示。我想将上下文路径添加到我的 URL

我可以通过http://localhost:8888访问站点,但我想将上下文路径添加到我的站点 URL,例如http://localhost:8888/MyApp

server {
    listen       8888;
    server_name  localhost;
   location{
        root    "C:/nginx/Share/dist";
    index  index.html index.htm;

   }

}

提前致谢

4

1 回答 1

0

您需要为此更改基本位置

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;

   }
}
于 2017-09-29T21:20:41.430 回答