2012-02-18 47 views

回答

-1

我不相信它有可能,u言不由衷配置DNS請求的文件夾,如果u創建一個文件夾/ XYZü可以創建框架打開本地主機:9000

但如果u真的想要達到理想的效果我建議你使用子域名。

5

您是否嘗試過類似...

server { 
    listen 80; 
    server_name example.com; 
    root /path/to/webroot; 

    location/{ 
     # For requests to www.myserver.com/A 
     location ~ ^/A { 
      proxy_pass localhost:8000; 
     } 
     # For requests to www.myserver.com/B 
     location ~ ^/B { 
      proxy_pass localhost:9000; 
     } 
     # Some will skip the "A" or "B" flags ... so handle these 
     proxy_pass localhost:9000$request_uri; 
    } 

這可擴展/提煉成類似....

location/{ 
     # For requests to www.myserver.com/A/some/request/string 
     location ~ ^/A(.+)$ { 
      proxy_pass localhost:8000$1; 
     } 
     # For requests to www.myserver.com/B/some/request/string 
     location ~ ^/B(.+)$ { 
      proxy_pass localhost:9000$1; 
     } 
     # Some will skip the "A" or "B" flags ... so handle these 
     proxy_pass localhost:9000$request_uri; 
    } 

一個更好的辦法或許是趕上請求一個服務器並將其餘的默認設置爲其他....

location/{ 
     # For requests to www.myserver.com/A/some/request/string 
     location ~ ^/A(.+)$ { 
      proxy_pass localhost:8000$1; 
     } 
     # Send all other requests to alternate location. 
     # Handle both well formed and not well formed ones. 
     location ~ ^/(.)/(.+)$ { 
      proxy_pass localhost:9000/$1; 
     } 
     proxy_pass localhost:9000$request_uri; 
    } 
} 
相關問題