我有一个在带有 Apache/HTTPD 的 Red Hat 上运行的 Python 2.7 应用程序。
我正在设置新服务器,但遇到了无法启动 HTTPD 服务的状况。输出完全不具描述性:
[root@*****]# systemctl restart 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@*****]# echo $?
1
[root@*****]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2021-12-23 12:42:36 CET; 2min 28s ago
Docs: man:httpd.service(8)
Process: 506512 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 506512 (code=exited, status=1/FAILURE)
[root@*****]# httpd -S
VirtualHost configuration:
*:80 *****.com (/etc/httpd/conf.d/vhost_aaa.conf:14)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex lua-ivm-shm: using_defaults
Mutex proxy: using_defaults
Mutex ldap-cache: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/etc/httpd/run/" mechanism=default
Mutex cache-socache: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
PidFile: "/etc/httpd/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="***" id=****
Group: name="***" id=****
[root@*****]# httpd -t
Syntax OK
我发现使用一切正常
httpd -X
另外还有另一台服务器正在运行相同的 vhost 配置。
error_log 和 access_log 中没有任何有用的内容。
有人可以指导我进一步的调试步骤或提出解决方案吗?
答案1
事实证明,服务器有由 SELinux 强制执行的额外限制。
运行命令使HTTPD在多个进程中运行可以解决问题:
semanage permissive -a httpd_t