Linux下修改Apache即httpd的端口
停止httpd服务
[root@67 sbin]# service httpd stop Redirecting to /bin/systemctl stop httpd.service
查看httpd的状态,确认httpd服务已经停止
[root@67 sbin]# service httpd status Redirecting to /bin/systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8) 8月 23 03:36:01 67.59.247.60.static.bjtelecom.net systemd[1]: Reloading The Apache HTTP Server. 8月 23 03:36:07 67.59.247.60.static.bjtelecom.net systemd[1]: Reloaded The Apache HTTP Server. 8月 30 03:29:01 67.59.247.60.static.bjtelecom.net systemd[1]: Reloading The Apache HTTP Server. 8月 30 03:29:07 67.59.247.60.static.bjtelecom.net systemd[1]: Reloaded The Apache HTTP Server. 9月 05 03:37:01 67.59.247.60.static.bjtelecom.net systemd[1]: Reloading The Apache HTTP Server. 9月 05 03:37:01 67.59.247.60.static.bjtelecom.net systemd[1]: Reloaded The Apache HTTP Server. 9月 06 03:27:01 67.59.247.60.static.bjtelecom.net systemd[1]: Reloading The Apache HTTP Server. 9月 06 03:27:11 67.59.247.60.static.bjtelecom.net systemd[1]: Reloaded The Apache HTTP Server. 9月 11 14:29:34 67.59.247.60.static.bjtelecom.net systemd[1]: Stopping The Apache HTTP Server... 9月 11 14:29:35 67.59.247.60.static.bjtelecom.net systemd[1]: Stopped The Apache HTTP Server.
查找httpd.conf配置文件的存放路径
find / -name httpd.conf
编辑httpd.conf配置文件
查找Listen配置段
修改Listen后面的端口,默认是80,这里修改为8080
保存并退出
修改后需要再次启动httpd服务