httpd: could not bind to address 0.0.0.0:19999
Posted: 2023 May 03, 22:27
After adding the port 19999 in the configuration file (httpd.conf) when restarting the web server (httpd) the following error is observed
The solution is done by adding port 19999 in SELinux Policy Management as follows
Restart httpd service
Check httpd.service status
Check if port 19999 has been added to SELinux
To delete the port from SELinux execute the following command
222222
Check if port 19999 has been deleted from SELinux
Code: Select all
[root @ CentOS ~]$ 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 Mon 2019-01-28 16:16:22 EET; 9s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11451 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 15626 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Process: 11450 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11450 (code=exited, status=1/FAILURE)
Jan 28 16:16:22 web.127001.ro httpd[11450]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:19999
Jan 28 16:16:22 web.127001.ro httpd[11450]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:19999
Jan 28 16:16:22 web.127001.ro httpd[11450]: no listening sockets available, shutting down
Jan 28 16:16:22 web.127001.ro httpd[11450]: AH00015: Unable to open logs
Jan 28 16:16:22 web.127001.ro systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 28 16:16:22 web.127001.ro kill[11451]: kill: cannot find process ""
Jan 28 16:16:22 web.127001.ro systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 28 16:16:22 web.127001.ro systemd[1]: Failed to start The Apache HTTP Server.
Jan 28 16:16:22 web.127001.ro systemd[1]: Unit httpd.service entered failed state.
Jan 28 16:16:22 web.127001.ro systemd[1]: httpd.service failed.
Code: Select all
[root @ CentOS ~]$ semanage port -a -t http_port_t -p tcp 19999
Code: Select all
[root @ CentOS ~]$ systemctl restart httpd.service
Code: Select all
[root @ CentOS ~]$ systemctl status httpd.service
Active: active (running) since Mon 2019-01-28 16:18:45 EET; 1min 34s ago
Jan 28 16:18:45 web.127001.ro systemd[1]: Stopped The Apache HTTP Server.
Jan 28 16:18:45 web.127001.ro systemd[1]: Starting The Apache HTTP Server...
Jan 28 16:18:45 web.127001.ro systemd[1]: Started The Apache H
Code: Select all
[root @ CentOS ~]$ semanage port -l | grep ^http_port_t
http_port_t tcp 19999, 80, 81, 443, 488, 8008, 8009, 8443, 9000
Code: Select all
[root @ CentOS ~]$ semanage port --delete -t http_port_t -p tcp 19999
Check if port 19999 has been deleted from SELinux
Code: Select all
[root @ CentOS ~]$ semanage port -l | grep ^http_port_t
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000