2013-04-28 95 views
0

我從一個指針的網站,使能/對的Qooxdoo其中/var/www/qooxdoo/nginx.conf我有以下幾點:nginx配置。如何給不同的網站不同的名字?

server { 
    listen 80; ## listen for ipv4; this line is default and implied 


    root /var/www/qooxdoo; 
    index index.html index.htm; 

    # Make site accessible from http://localhost/ 
    server_name localhost; 
} 

訪問該網站,我需要做的:本地主機/ 這它。但我如何給該網站命名?

例如,本地主機/站點1的排序。

在此先感謝您的幫助 jenia Ivlev型

+0

你想給什麼樣的名字? – 2013-04-29 13:28:03

回答

1

取決於你究竟想達到。考慮到文件系統中的以下目錄。

/var/www 
    - site-1 
    - site-2 
    - ... 
    - site-n 

現在你可以在URL中使用簡單的目錄,如果你像你所做的那樣配置nginx。

server { 
    listen 80; 
    root /var/www; 
    index index.html index.htm; 
    server_name localhost; 
} 

請求http://localhost/site-1將返回文件/var/www/site-1/index.html(與同爲site-2高達site-n)的內容。

如果您想使用子域,您可以執行以下操作。

server { 
    listen 80; 
    root /var/www/site-1; 
    index index.html index.htm; 
    server_name site-1.localhost; 
} 

server { 
    listen 80; 
    root /var/www/site-2; 
    index index.html index.htm; 
    server_name site-2.localhost; 
} 

server { 
    listen 80; 
    root /var/www/site-n; 
    index index.html index.htm; 
    server_name site-n.localhost; 
} 

請求http://site-1.localhost/將返回文件/var/www/site-1/index.html(與同爲site-2高達site-n)的內容。

相關問題