2017-05-09 31 views
0

首先我的英語道歉,因爲它不是很好。我是nginx的新手,我有一個基本的疑問:Nginx不同目錄中的幾個項目

什麼是最簡單的方式與nginx(分隔在不同的目錄中)使用一臺機器,具有相同的IP和相同的端口的多個項目?

example.com/project1 
example.com/project2 
example.com/project3 

親切的問候。

回答

0

您將需要在單個服務器塊中的多個位置指令來執行您需要爲每個項目執行的操作。位置指令中的內容實際上取決於它們的項目類型。例如,我有一些WordPress實例,它們會在這些位置指令中包含fastcgi配置行。

實施例:

server { 
    listen 80; 
    server_name example.com; 

    location /project1 { 
     # What goes here depends on what type of project this is. 
    } 
    location /project2 { 
     # What goes here depends on what type of project this is. 
    } 
    location /project3 { 
     # What goes here depends on what type of project this is. 
    } 
}