2016-08-13 60 views
0

我想從我的nas運行gogs。我從我的nas上運行其他東西,所以我決定讓gog成爲一個子域。這裏是我的嘗試:作爲nginx子域運行gogs

/etc/nginx/sites-enabled/default

server { 
     listen 80; 
     server_name gogs.nas.me; 

     location/{ 
       proxy_pass http://127.0.0.1:3237; 
       proxy_set_header Host $host; 
       proxy_buffering off; 
     } 
} 

我不爲她有一個域名,但我有nas.me/etc/hosts192.168.0.120指點。

當我去​​3210,我得到gogs.nas.me’s server DNS address could not be found.當我去nas.me,我得到我的nas的索引。我究竟做錯了什麼?

編輯:我也嘗試使用nas.me/gogs,它工作,但所有的資產沒有得到/gogs前綴,所以我得到404的一切,但/

+0

答案在於錯誤描述'gogs.nas.me的服務器DNS地址無法找到.'這意味着您沒有該子域的DNS記錄。 –

+0

@IVOGELOV我將如何添加? – Marcel

+0

最簡單的方法是在'/ etc/hosts'中將'gogs.nas.me'添加到與'nas.me'相同的行 - 假設這個文件在你的筆記本電腦上,而不在NAS上。 –

回答

2

您應該添加​​3210到文件/etc/hosts這樣的:

192.168.0.120 nas.me gogs.nas.me 

兩個人的名字應該是在同一行,否則會出現錯誤的行爲(看看這個答案 - unix.stackexchange.com/a/102663) 通常添加新/etc/hosts中的DNS條目不需要重新啓動 - 但爲了安全起見,您可以重新啓動。