2011-08-22 116 views
0

我有關於Apache的問題,因爲我知道,通過默認的Apache工作的80端口,我需要改變這個默認端口到另一個,說8080改變默認的Apache端口

實際上,我已經成功地改變了這個端口通過對Apache配置編輯 Listen 80Listen 8080

但問題是,我需要添加:8080裏面的網址,所以我要求的網站,像這樣: http://localhost:8080

是否有可能去除8080在網址上?

因爲我需要關閉端口80,而不必關閉服務器以供公衆訪問。

+0

嗨,你的問題是不是真的在我看來的stackoverflow主題。由於問題是關於網絡/服務器問題,所以我正在投票脫離主題,不幸的是,無法從移到serverfault獲得更好的答案。 (霍克斯沃思是現貨答案) – Flexo

回答

4

無法將標準瀏覽器連接到非標準HTTP端口,而無需將端口明確聲明爲URL的一部分,否則不可能。

+0

嗨霍克斯沃思,感謝您的答案,我該怎麼做到這一點?也許你可以給我anotes :) – Kadugedeboy

+0

通過「顯式聲明爲URL的一部分」,我認爲hoxworth意味着你在問題中寫的是正確的,即「http:// localhost:8080」 – Flexo

0

試...

http://httpd.apache.org/docs/2.0/vhosts/examples.html

您有多個域去同一個IP,也想提供多個端口。通過在「NameVirtualHost」標籤中定義端口,您可以允許它工作。如果您嘗試使用沒有NameVirtualHost名稱的端口,或者嘗試使用Listen指令,則您的配置將不起作用。

Server configuration 

Listen 80 
Listen 8080 

NameVirtualHost 172.20.30.40:80 
NameVirtualHost 172.20.30.40:8080 

<VirtualHost 172.20.30.40:80> 
ServerName www.example1.com 
DocumentRoot /www/domain-80 
</VirtualHost> 

<VirtualHost 172.20.30.40:8080> 
ServerName www.example1.com 
DocumentRoot /www/domain-8080 
</VirtualHost> 

<VirtualHost 172.20.30.40:80> 
ServerName www.example2.org 
DocumentRoot /www/otherdomain-80 
</VirtualHost> 

<VirtualHost 172.20.30.40:8080> 
ServerName www.example2.org 
DocumentRoot /www/otherdomain-8080 
</VirtualHost>