修改默认apache端口



我对apache有疑问,据我所知,默认情况下apache工作在端口80上,我需要将这个默认端口更改为另一个,例如8080。

实际上,我已经成功地更改了这个端口,通过在apache配置上编辑Listen 80Listen 8080

但问题是,我需要在url中添加:8080,所以我请求网站如下:http://localhost: 8080

是否可以删除url上的8080 ?

因为我需要关闭80端口,而不需要关闭服务器以供公共访问

如果不显式地声明端口作为URL的一部分,则不可能将标准浏览器连接到非标准HTTP端口,

try…

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

你有多个域到同一个IP,也想服务多个端口。通过在"NameVirtualHost"标签中定义端口,您可以允许它工作。如果您尝试使用没有NameVirtualHost name:port或您尝试使用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>

最新更新