如果有一种方法可以在不使用别名的情况下完成这个典型的任务,我完全支持它。
我希望/minesweeper/*URL 上的所有请求都从与其他请求完全不同的目录中提取。以下配置有效,文件已提供,但 MIME 类型是 application/octet-stream 而不是应有的类型(即 text/css)。如果 MIME 类型不正确,Web 浏览器就无法呈现文档中的 CSS 样式。
nginx.conf:
http {
index index.html
include /etc/nginx/mime.types;
default_type application/octet-stream;
...
}
virtual.conf:
server {
listen *:80;
server_name djmp.org www.djmp.org;
root /home/devsites/djmp.org/public_html/;
index index.html;
location ~ ^/minesweeper($|/.*) {
alias /home/michael/sites/minesweeper$1;
}
}
Run Code Online (Sandbox Code Playgroud) nginx ×1