apache2修改默认端口
Contents
apache2修改默认端口
apache2的默认端口是80端口,但80这个端口一般都是被其他服务占用的, 所以为了避免冲突,有时候我们需要修改下apache2的端口。 apache2的配置端口的文件在/etc/apache2内的ports.conf文件中 首先打开终端进入appache2的配置文件夹 cd /etc/apache2/ 使用vi编辑器进入编辑模式 sudo vi ports.conf 把80端口改成自己想改的端口(我这里把80端口改成980端口,将443端口改为9443端口) 改完保存并退出 重启apache2 sudo /etc/init.d/apache2 restart
本机设置前为:
If you just change the port or add more ports here, you will likely also
have to change the VirtualHost statement in
/etc/apache2/sites-enabled/000-default.conf
Listen 80
vim: syntax=apache ts=4 sw=4 sts=4 sr noet
本机设置后为:
If you just change the port or add more ports here, you will likely also
have to change the VirtualHost statement in
/etc/apache2/sites-enabled/000-default.conf
Listen 980