httpmake_sock: could not bind to address

centos7中在通过同个ip,使用不同的端口启动http服务时,出现以下错误。
[[email protected] user]# systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.

[[email protected] user]# systemctl status -l httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2017-08-31 23:20:41 PDT; 12s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11310 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)

Process: 11305 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11305 (code=exited, status=1/FAILURE)

8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: no listening sockets available, shutting down
8月 31 23:20:41 localhost.localdomain httpd[11305]: AH00015: Unable to open logs
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
8月 31 23:20:41 localhost.localdomain kill[11310]: kill: cannot find process “”
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 31 23:20:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
8月 31 23:20:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service failed.
[[email protected] user]# systemctl status -l httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2017-08-31 23:20:41 PDT; 40s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11310 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)

Process: 11305 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11305 (code=exited, status=1/FAILURE)

8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: no listening sockets available, shutting down
8月 31 23:20:41 localhost.localdomain httpd[11305]: AH00015: Unable to open logs
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
8月 31 23:20:41 localhost.localdomain kill[11310]: kill: cannot find process “”
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 31 23:20:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
8月 31 23:20:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service failed.

原因:seLinux阻止8081端口启动
解决方法:

httpmake_sock: could not bind to address

输入这两条指令:
[[email protected] user]# ausearch -c ‘httpd’ –raw | audit2allow -M my-httpd
libsepol.sepol_string_to_security_class: unrecognized class dir
libsepol.sepol_string_to_security_class: unrecognized class tcp_socket
********** IMPORTANT *************
To make this policy package active, execute:

semodule -i my-httpd.pp

[[email protected] user]# semodule -i my-httpd.pp
[[email protected] user]# systemctl restart httpd.service