Nginx_Apache - Httpd failed to start

Rezaa

Verified User
Joined
Dec 15, 2010
Messages
75
I just installed Directadmin on my new Cloudlinux server and configured it to run nginx_apache.
But once the DA installation finished, I realized that httpd is not running and when I try to restart it I get the following error:
Code:
# service httpd restart
Redirecting to /bin/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.

and when I browse a .php file I get "502 Bad Gateway - nginx".

Any hope to solve this?
 
Hello,

try [coed]./build rewrite_confs[/code]

if it does not help provide results of the following commands:

Code:
nginx -t
Code:
apachectl -t
Code:
netstat -ntpl | grep 80
Code:
[COLOR=#333333]systemctl status httpd.service
[/COLOR]
Code:
[COLOR=#333333]systemctl status nginx.service
[/COLOR]
 
Thank you but "./build rewrite_confs" didn't help.

Here is the output of other commands:
Code:
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Code:
# apachectl -t
httpd: Syntax error on line 157 of /etc/httpd/conf/httpd.conf: Syntax error on line 2 of /etc/httpd/conf/extra/httpd-includes.conf: Syntax error on line 1 of /etc/httpd/conf/extra/modproctitle.conf: Cannot load /usr/lib/apache/mod_proctitle.so into server: /usr/lib/apache/mod_proctitle.so: cannot open shared object file: No such file or directory
Code:
# netstat -ntpl | grep 80
tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      576824/nginx: maste
tcp        0      0 [***EDITED***]:80           0.0.0.0:*               LISTEN      576824/nginx: maste
Code:
# systemctl status httpd.service
â httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-10-08 14:33:06 EDT; 27s ago
  Process: 577725 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 577723 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 577723 (code=exited, status=1/FAILURE)

Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: Starting The Apache HTTP Server...
Oct 08 14:33:06 server1.[***EDITED***].com httpd[577723]: httpd: Syntax error on line 157 of /etc/httpd/conf/httpd.conf: Syntax error on line 2 of /etc/httpd/conf/extra/httpd-includes.conf: Syntax error on line 1 of /etc/httpd/conf/extra/...
Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 08 14:33:06 server1.[***EDITED***].com kill[577725]: kill: cannot find process ""
Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: httpd.service: control process exited, code=exited status=1
Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: Failed to start The Apache HTTP Server.
Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: Unit httpd.service entered failed state.
Oct 08 14:33:06 server1.[***EDITED***].com systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
Code:
# systemctl status nginx.service
â nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2018-10-08 14:28:26 EDT; 5min ago
  Process: 576809 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
  Process: 577490 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 576823 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
  Process: 576820 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 576824 (nginx)
   CGroup: /system.slice/nginx.service
           ââ576824 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           ââ577492 nginx: worker process
           ââ577493 nginx: worker process
           ââ577494 nginx: worker process
           ââ577495 nginx: worker process
           ââ577496 nginx: worker process
           ââ577497 nginx: worker process
           ââ577498 nginx: worker process
           ââ577499 nginx: worker process

Oct 08 14:28:26 server1.[***EDITED***].com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 08 14:28:26 server1.[***EDITED***].com nginx[576820]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Oct 08 14:28:26 server1.[***EDITED***].com nginx[576820]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Oct 08 14:28:26 server1.[***EDITED***].com systemd[1]: Started The nginx HTTP and reverse proxy server.
Oct 08 14:29:01 server1.[***EDITED***].com systemd[1]: Reloaded The nginx HTTP and reverse proxy server.
 
Last edited:
Did you restart the server after CloudLinux installation complete?


Will The following help?

Code:
cd  /usr/local/directadmin/custombuild/
./build set cloudlinux yes
./build apache
./build rewrite_confs
 
And another question.
This is my first nginx server. So I'm not quite sure if this is a right choice.
What do you prefer? nginx_apache or nginx only ?
We are running a shared web hosting server with 200-300 accounts.
 
Sorry, didn't see your last reply.
Yes I restarted the server after Cloudlinux installation complete.
I will try the commands you provided and will back to you shortly.
 
./build apache was not successful.
Code:
  Plugin Options:
./build: line 9755: cmake: command not found
make: *** No rule to make target `install'.  Stop.
Restarting apache.
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
Do I need to install cmake and c++ to make it work?
 
Installed cmake and tried your commands again. now both nginx and apache are running perfectly.
Thank you so much zEitEr :)
 
I have a this problem and my output of commands is similar by Rezaa , But not run Apache and show 502 Bad Gateway .
nginx.
Please help

-- Unit httpd.service has failed.
--
-- The result is failed.
Oct 09 15:40:07 myserver.com systemd[1]: Unit httpd.service entered failed state.
Oct 09 15:40:07 myserver.com[1]: httpd.service failed.
Oct 09 15:40:07 myserver.com systemd[1]: PID file /run/php-fpm56.pid not readable (yet?) after reload.
Oct 09 15:40:07 myserver.com systemd[1]: Reloaded The PHP FastCGI Process Manager.
-- Subject: Unit php-fpm56.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php-fpm56.service has finished reloading its configuration
--
-- The result is done.
Oct 09 15:40:15 myserver.com kernel: Firewall: *UDP_IN Blocked* IN=eth0 OUT= MAC=00:22:3c:7:7c:78:00:0c:32:eb:2c:d7:09:00 SRC
~
 
Last edited:
@Rezaa,

You are welcome.


@absoonoo,

So you run only NGINX+PHP-FPM? What you see with
Code:
./build options
?
 
Build option:
Apache: 2.4.35
Nginx (reverse proxy): 1.15.1
mod_ruid2: 0.9.8
ModSecurity: no
htscanner: no
Dovecot: 2.3.3
Dovecot configuration: yes
AWstats: no
Exim: 4.91
exim.conf update: yes, release 4.3
BlockCracking: no
Easy Spam Fighter: no
SpamAssassin: no
ClamAV: no
MariaDB: 10.0.36
MySQL backup: yes
MySQL backup directory: /usr/local/directadmin/custombuild/mysql_backups
MySQL compress backups: no
PHP (default): 7.2 as php-fpm
PHP (additional): 5.6 as php-fpm
phpMyAdmin: 4.8.3-all-languages
ProFTPD: no
Pure-FTPd: 1.0.47
RoundCube webmail: 1.3.7
Replace "php.ini" with './build all' and './build php_ini': no
Auto updates/notifications: no
Run "clean" every time: yes
Run "clean_old_webapps" every time: yes
Run "clean_old_tarballs" every time: yes
Show texts in bold: yes
SquirrelMail: no
Zend Guard Loader: yes
ionCube loader: 10.2.4
Suhosin: no
now run Nginx but see this error and after few miute server ping down but after restart ping back :
Oct 13 22:03:01 myserver systemd: Started Session 45 of user root.
Oct 13 22:03:01 myserver systemd: Starting Session 45 of user root.
Oct 13 22:04:01 myserver systemd: Started Session 46 of user root.
Oct 13 22:04:01 myserver systemd: Starting Session 46 of user root.
Oct 13 22:04:05 myserver kernel: Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00::00:0c:42:eb:2c:d7:08:00 SRC=189.114.123.238 DST=5.61.29.30 LEN=44 TOS=0x00 PREC=0x00 TTL=232 ID=53096 DF PROTO=TCP SPT=31071 DPT=81 WINDOW=14600 RES=0x00 SYN URGP=0
Oct 13 22:04:53 myserver kernel: Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00::00:0c:42:eb:2c:d7:08:00 SRC=187.107.19.159 DST=5.61.29.30 LEN=40 TOS=0x00 PREC=0x00 TTL=42 ID=3124 PROTO=TCP SPT=52740 DPT=23 WINDOW=53994 RES=0x00 SYN URGP=0
Oct 13 22:05:01 myserver systemd: Started Session 48 of user root.
Oct 13 22:05:01 myserver systemd: Starting Session 48 of user root.
Oct 13 22:05:01 myserver systemd: Started Session 47 of user root.
Oct 13 22:05:01 myserver systemd: Starting Session 47 of user root.
Oct 13 22:05:26 myserver dbus[688]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service'
Oct 13 22:05:26 myserver systemd: Starting Time & Date Service...
Oct 13 22:05:26 myserver dbus[688]: [system] Successfully activated service 'org.freedesktop.timedate1'
Oct 13 22:05:26 myserver systemd: Started Time & Date Service.
 
Last edited:
By itself the lines from systemd do not show anything wrong yet, at least those lines do not have anything to do with ping.

p.s. you need to disable mod_ruid2 if you use PHP-FPM (search the forums on how to do it).
 
Back
Top