首页 > 技术文章 > Nginx系统学习笔记(3)同一端口下设置Alias(虚拟目录)

61007257Steven 2021-01-27 10:38 原文

server {
        listen       8080;
        server_name  localhost;
     

    location / {
    root   C:/nginx-1.14.2/html/xxx;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }

    location /sample {
        alias C:/nginx-1.14.2/html/sample;
        add_header Cache-Control no-store;
                index  index.html index.htm detail detail.html detail.htm;
        try_files $uri $uri/ /sample/detail.html;
    }
  
  location @router { rewrite
^.*$ /index.html last;   }
error_page
500 502 503 504 /50x.html;     location = /50x.html {     root html;   }
location
/api/ { # rewrite ^.+apis/?(.*)$ /$1 break; include uwsgi_params; proxy_pass http://xxx:yyy/api/; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s;   } }

 

推荐阅读