OpenStack部署记录-Apache httpd启动失败

Apache httpd启动失败

[root@controller ~]# systemctl start httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

报错原因:

[root@controller ~]# journalctl -xe
-- 
-- Unit httpd.service has failed.
-- 
-- The result is failed.
10月 23 14:04:35 controller systemd[1]: Unit httpd.service entered failed state.
10月 23 14:04:35 controller systemd[1]: httpd.service failed.
10月 23 14:04:35 controller polkitd[691]: Unregistered Authentication Agent for unix-process:2499:56227 (system bus na
10月 23 14:07:06 controller firewalld[721]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure conf
10月 23 14:07:21 controller polkitd[691]: Registered Authentication Agent for unix-process:2632:72868 (system bus name
10月 23 14:07:21 controller systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has begun starting up.
10月 23 14:07:21 controller httpd[2638]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:5000
10月 23 14:07:21 controller httpd[2638]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:5000
10月 23 14:07:21 controller httpd[2638]: no listening sockets available, shutting down
10月 23 14:07:21 controller httpd[2638]: AH00015: Unable to open logs
10月 23 14:07:21 controller systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
10月 23 14:07:21 controller systemd[1]: Failed to start The Apache HTTP Server.

看到有这样一行错误信息Permission denied: AH00072: make_sock: could not bind to address [::]:5000
百度查了下许多人说是SELinux的问题,看了一下http果然没有放通5000端口

[root@controller ~]# semanage port -l | grep -w http_port_t
http_port_t                    tcp      8000, 80, 81, 443, 488, 8008, 8009, 8443, 9000

尝试添加端口,但是报错了

[root@controller ~]# semanage port -a -t http_port_t -p tcp 5000
ValueError: 已定义端口 tcp/5000

再查一下,原来5000端口一定定义了,只不过不是http

[root@controller ~]# semanage port -l | grep 5000
cluster_port_t                 tcp      5149, 40040, 50006-50008
cluster_port_t                 udp      5149, 50006-50008
commplex_main_port_t           tcp      5000
commplex_main_port_t           udp      5000
hplip_port_t                   tcp      1782, 2207, 2208, 8290, 8292, 9100, 9101, 9102, 9220, 9221, 9222, 9280, 9281, 9282, 9290, 9291, 50000, 50002\

网上很多方法都是关闭selinux,本着安全原则不想关。网上还有说是openstack-selinux包没安装成功的,检查了也不是这个问题

[root@controller ~]# rpm -qa | grep openstack-selinux
openstack-selinux-0.8.26-1.el7.noarch

最终方法:修改selinux端口

# semanage port -m -t http_port_t -p tcp 5000

最后成功启动http服务

[root@controller ~]# systemctl start httpd
[root@controller ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2022-10-23 14:18:32 CST; 6s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 3121 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─3121 /usr/sbin/httpd -DFOREGROUND
           ├─3122 (wsgi:keystone- -DFOREGROUND
           ├─3123 (wsgi:keystone- -DFOREGROUND
           ├─3124 (wsgi:keystone- -DFOREGROUND
           ├─3125 (wsgi:keystone- -DFOREGROUND
           ├─3126 (wsgi:keystone- -DFOREGROUND
           ├─3127 /usr/sbin/httpd -DFOREGROUND
           ├─3128 /usr/sbin/httpd -DFOREGROUND
           ├─3129 /usr/sbin/httpd -DFOREGROUND
           ├─3130 /usr/sbin/httpd -DFOREGROUND
           └─3131 /usr/sbin/httpd -DFOREGROUND

10月 23 14:18:32 controller systemd[1]: Starting The Apache HTTP Server...
10月 23 14:18:32 controller systemd[1]: Started The Apache HTTP Server.
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容