如何将表单的URI映射staging.example.com/siteA到位于的虚拟服务器/var/www/siteA?
主要限制是我不想为siteA创建子域.我到目前为止看到的所有nginx.conf示例都依赖于子域来进行映射.
谢谢
sjy*_*sjy 17
您可以在块中使用root指令location,如下所示:
server {
server_name staging.example.com;
root /some/other/location;
location /siteA/ {
root /var/www/;
}
}
Run Code Online (Sandbox Code Playgroud)
然后http://staging.example.com/foo.txt指向/some/other/location/foo.txt,同时http://staging.example.com/siteA/foo.txt指向/var/www/siteA/foo.txt.
请注意,该siteA目录仍然应该存在于文件系统中.如果要http://staging.example.com/siteA/foo.txt指向/var/www/foo.txt,则必须使用该alias指令:
location /siteA/ {
alias /var/www;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12637 次 |
| 最近记录: |