This is an Amazon Linux 2 environment.
Do the following
$sudo systemctl start httpd.service
The following error occurred:
Job for httpd.service failed because the control process expired with error code.See "systemctl status httpd.service" and "journalctl-exe" for details.
[ec2-user@ip-w-x-y-zwww] $sudo systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
--php-fpm.conf
Active: failed (Result: exit-code)
Docs:man:httpd.service(8)
Process: 3650 ExecStart=/usr/sbin/httpd$OPTIONS-DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 3650 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
: Starting The Apache HTTP Server...
: (98) Address already in use: AH00072: make_sock: could not bind to address [::]: 80
: (98) Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
: no listening sockets available, shutting down
systemd[1] —httpd.service failed.
Address already in use: So I decided to look into the process.
$sudolsof-i | grep http
nginx3109 root6u IPv4 185880t0 TCP*: http (LISTEN)
nginx3109 root7u IPv6 185890t0 TCP*: http (LISTEN)
nginx3110 nginx6u IPv4 185880t0 TCP*: http (LISTEN)
nginx3110 nginx7u IPv6 185890t0 TCP*: http (LISTEN)
$sudokill-93109
I tried...
$sudolsof-i | grep http
nginx3109 root6u IPv4 185880t0 TCP*: http (LISTEN)
nginx3109 root7u IPv6 185890t0 TCP*: http (LISTEN)
nginx3110 nginx6u IPv4 185880t0 TCP*: http (LISTEN)
nginx3110 nginx7u IPv6 185890t0 TCP*: http (LISTEN)
It didn't disappear...
How can I start Apache?
apache amazon-linux
I think it's because Nginx on the same web server is up and you're using port 80 first, but if you don't need to run it at the same time, stop Nginx first and try starting Apache.
$sudo systemctl stop nginx
$ sudo systemctl disable nginx
© 2024 OneMinuteCode. All rights reserved.