Can't Restart HTTPD on CentOS 7
Ok, mystery solved; thanks to Gerald Schneider.(although it was not a trojan, thankfully)
Executing ps -Af | grep $pid
gave me some more insight and highlighted GitLab to my attention.(I knew there was something fishy about it but couldn't get to the root cause of the issue and identify it properly)
httpd
was conflicting with gitlab
. Once I executed sudo gitlab-ctl stop
and then tried restarting httpd
, everything was business as usual.
Also, this question gives some more insight into Apache - GitLab - Nginx dilemma.(and the first mention is that Apache and GitLab contradicts on port 80 :])
Related videos on Youtube
Can Sürmeli
Updated on September 18, 2022Comments
-
Can Sürmeli over 1 year
I've an instance running CentOS 7. And I'm having a difficulty when/if I restart
httpd
.My configuration is working fine, my sites are broadcasted as I wanted; moreover, when I execute the command
sudo apachectl configtest
, I get backSyntax OK
.But when I restart
httpd
, it fails to comply with the following status message:● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2018-08-28 12:30:26 CEST; 6s ago Docs: man:httpd(8) man:apachectl(8) Process: 9569 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 9568 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 9568 (code=exited, status=1/FAILURE) Aug 28 12:30:26 vps httpd[9568]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 Aug 28 12:30:26 vps httpd[9568]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 Aug 28 12:30:26 vps httpd[9568]: no listening sockets available, shutting down Aug 28 12:30:26 vps httpd[9568]: AH00015: Unable to open logs Aug 28 12:30:26 vps systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE Aug 28 12:30:26 vps kill[9569]: kill: cannot find process "" Aug 28 12:30:26 vps systemd[1]: httpd.service: control process exited, code=exited status=1 Aug 28 12:30:26 vps systemd[1]: Failed to start The Apache HTTP Server. Aug 28 12:30:26 vps systemd[1]: Unit httpd.service entered failed state. Aug 28 12:30:26 vps systemd[1]: httpd.service failed.
I get that something else is working in place of
httpd
when I restart it. Therefore I executenetstat -tulpn | grep :80
.tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 2560/nginx: master tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2560/nginx: master tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 1434/unicorn master tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN 1307/sidekiq 5.1.3
The above result kind of confuses me since I don't have
Nginx
installed on my system andwhich nginx
also returns nothing.However, when I reboot my instance,
httpd
works as intended.What should I do to resolve my issue?
-
dortegaoh over 5 yearsyou have the process id from nginx, you can use
ps -Af |grep $pid
to see the full path of the program.
-
-
dortegaoh over 5 yearsthe postfix process is direcly called
master
, notnginx: master
. And postfix usually does not block port 80. There is surely is an nginx running, the question is just where it is located. -
Dileep KK over 5 yearsAnyway he said nginx is not installed. You can try stopping nginx by 'nginx -s stop' command to see the results.
-
dortegaoh over 5 yearsThe OP most probably only checked the system packages if it is installed. It still can have been compiled from source. If
which nginx
has no result nginx is clearly not in the path, songinx -s stop
gains nothing. -
dortegaoh over 5 yearsChances are slim that a systemd unit exists when nginx has not been installed via system packages. And there is still the possibility that it isn't an actual nginx, but rather a trojan.
-
Can Sürmeli over 5 yearsMoreover, I tried stopping
postfix
and then restartinghttpd
. Didn't help. -
jaskij over 5 yearsI'm guessing you are using an omnibus installation. Change the port and set up Apache as a reverse proxy (be warned SSL in proxy termination is a pain for GL to configure) docs.gitlab.com/omnibus/settings/…