1. 程式人生 > >如何修改Apache預設埠

如何修改Apache預設埠

第一步:編輯httpd配置檔案 #vim /etc/httpd/conf/httpd.conf 將Listen 80 修改為Listen 8888 第二步:新增防火牆埠號 centos6.5: # /sbin/iptables -I INPUT -p tcp --dport 8888 -j ACCEPT # service iptables save # service iptables restart 或直接修改檔案/etc/sysconfig/iptables. # vi /etc/sysconfig/iptables -A INPUT -p tcp -m tcp --dport 8888 -j ACCEPT # service iptables restart 檢視防火牆埠狀態:/etc/init.d/iptables status centos7: 查詢埠號:firewall-cmd --query-port=8888/tcp 查詢埠號8888 是否開啟 開永久埠號:firewall-cmd --add-port=8888/tcp --permanent 這裡把8888替換為需要開的埠號, --permanent是指永久的意思。 第三步:開啟selinux埠 # yum policycorcutils-python semanage port -l | grep http 檢視埠 semanage port -a -t http_port_t -p tcp 8888 新增埠 第四步:重啟httpd服務 centos6.5:service httpd restart centos7:systemctl restart httpd.service