繁体   English   中英

更改默认的Apache端口

[英]change default apache port

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

实际上,通过在Listen 80Listen 8080上对apache配置进行编辑,我已成功更改了此端口

但是问题是,我需要在URL内添加:8080,所以我要求使用以下网站: http:// localhost:8080

是否可以删除网址上的8080?

因为我需要关闭端口80,而无需关闭服务器以进行公共访问。

如果没有将端口明确声明为URL的一部分,则无法将标准浏览器连接到非标准HTTP端口。

尝试...

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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM