我是nginx新手。請幫我設置以下配置: site.com的根文件夾是/var/www(root /var/www)
。 但是當有人打開http://site.com時,我想從/var/www/home
加載內容。 如果有人試圖http://site.com/anything,我想從/var/www/anything
加載內容。nginx位置文件根目錄外
我嘗試以下
root /var/www;
location =/{
root /var/www/home
}
,但沒有奏效。
而且,我試圖
location =/{
root /var/www/home
}
location/{
root /var/www
}
,這再次沒有工作,
請幫
不起作用,你的意思是你得到404或什麼?並且是網站的php或rails或python,或者只是簡單的html? –
@Mohammad 它的htmt。當嘗試第一個選項 'root/var/www; location =/{ root/var/www/home }' 它總是匹配/ var/www 在第二個位置/匹配總是。我認爲site.com將匹配位置= /但它不會 – user2584292
您是否在服務器範圍內定義了索引? 'index index.html;' –