apache

https://www.cnblogs.com/itsfei/p/14016139.html

 

如何更改linux(centos)下的Apache http端口号

 

# vi  /etc/httpd/conf/httpd.conf  文件

 
修改两个地方
    #Listen 12.34.56.78:80
    Listen 80
    #把80改为你设置的端口,我设置端口为82
    Listen 82
 
    NameVirtualHost *:80
    #把80改为你设置的端口,我设置端口为82
    NameVirtualHost *:82

启动Apache
# service httpd start   发现启动失败

解决:(转自)http://blog.itechol.com/space-33-do-blog-id-5114.html

 Google 一下,发现原来是 SELinux  安全机制的作用。

(很难搞,如果很多牵扯的权限的事情找不到原因,就可以分析是否是它的作用)

解决方法如下:

查看selinux状态:

 

[root@cacti-test httpd]# sestatus

SELinux status:                 enabled

SELinuxfs mount:                /selinux

Current mode:                   enforcing

Mode from config file:          enforcing

Policy version:                 21

Policy from config file:        targeted

 

或者用

 

[root@cacti-test httpd]# getenforce

Enforcing

关闭selinux状态:(使用无启重启系统的方法)

详见:http://blog.itechol.com/space-33-do-blog-id-5088.html

[root@cacti-test httpd]# setenforce 0            关闭命令

[root@cacti-test httpd]# getenforce              重新查看selinux状态

 

Permissive  

 

尝试再次启动apache

 

 

 

[root@cacti-test httpd]# service httpd start

 

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

 

[  OK  ]        成功!!

 

转载链接:https://www.cnblogs.com/hoby2017/p/9930019.html

posted @ 2021-06-03 14:35  hean2020  阅读(53)  评论(0编辑  收藏  举报