1、前端配置
server {
listen 7077;
server_name localhost;
location / {
root /html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
2、alias,http://127.0.0.1:7077/web/test.pdf
D:\Project下面有个test.pdf
server {
listen 7077;
server_name localhost;
location /web
{
alias D:\Project;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
3、root
server {
listen 6001;
server_name 127.0.0.1;
root D:\Project;
}