实验环境:centos7.2,已安装httpd,80端口被占用。
编辑httpd配置文件:
#vim/etc/httpd/conf/httpd.conf
找到Listen,修改httpd监听端口:
重启apache服务:
#systemctlrestarthttpd.service
安装Nginx:
#yum-yinstallNginx
#Nginx-t
如果安装完成以后80端口被占用了,即使怎么停止占用80端口的应用,甚至删除应用,Nginx -t都会提示Nginx: [emerg] socket() [::]:80 Failed (97: Address family not supported by
解决办法是修改配置文件:(#vim /etc/Nginx/conf.d/default.conf)
listen80default_server; listen[::]:80default_server;
改成:
listen80default_server; #listen[::]:80default_server;
设置开机自动启动:
# systemctl enable Nginx.service
域名测试:
公网ip测试: