Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

NGINX and HTTPD not starting at reboot

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
10 posts • Page 1 of 1
pinkopanter
Posts: 4
Joined: Tue Dec 20, 2016 5:00 pm

NGINX and HTTPD not starting at reboot
  • Quote

Post by pinkopanter » Tue Dec 20, 2016 5:11 pm

New install of VestaCP. NGINX and HTTPD can start after server reboot. I have to manually restart the services. I run chkconfig nginx on and chkconfig httpd on, but with no help.

Anyone?
Top

damian.lavalle
Posts: 12
Joined: Tue Oct 18, 2016 10:14 am

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by damian.lavalle » Tue Dec 27, 2016 4:48 pm

Actually, I'm experiencing the same problem. And it's not just after reboots, it happens on it's own, possibly right after automatic updates. Anyone else have this issue? When I fist saw it I though it could be a problem with multiple applications attempting to control a single port. Port 80 to be specific. Like Apache has a default config attemtping to grab port 80 while Ngenix is wants that port too. As a result neither start. BUT that's just a guess.
Top

dpeca
VestaCP Team
Posts: 473
Joined: Wed Nov 25, 2015 7:30 pm

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by dpeca » Wed Dec 28, 2016 2:06 am

Try to add to /etc/rc.local these lines:

Code: Select all

sleep 3
service nginx restart
service nginx httpd
Top

Trentor
Posts: 84
Joined: Fri Apr 25, 2014 6:42 pm

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by Trentor » Fri Dec 30, 2016 5:35 pm

============================================================================================

nginx

1.Edit nginx service:

Code: Select all

nano /etc/systemd/system/multi-user.target.wants/nginx.service
2. Change this:

Code: Select all

After=nss-lookup.target remote-fs.target
To this:

Code: Select all

After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
============================================================================================

Apache

1. Edit apache service (modify "httpd" for your Apache name service):

Code: Select all

nano /etc/systemd/system/multi-user.target.wants/httpd.service


2. Do the same changes as nginx.

============================================================================================

Reboot your server.
Top

drcrash
Posts: 8
Joined: Thu Aug 04, 2016 11:16 am

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by drcrash » Sun Mar 26, 2017 6:22 am

Trentor wrote:============================================================================================

nginx

1.Edit nginx service:

Code: Select all

nano /etc/systemd/system/multi-user.target.wants/nginx.service
2. Change this:

Code: Select all

After=nss-lookup.target remote-fs.target
To this:

Code: Select all

After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
============================================================================================

Apache

1. Edit apache service (modify "httpd" for your Apache name service):

Code: Select all

nano /etc/systemd/system/multi-user.target.wants/httpd.service


2. Do the same changes as nginx.

============================================================================================

Reboot your server.
Thanks! It worked for me, but after this changes i got error when trying to restart httpd:
[root@web]# service httpd restart
env: /etc/init.d/httpd: Permission denied

and file /etc/init.d/httpd and /etc/rc.d/init.d is empty (CentOS 7)

may be i do some thing else

when i rebooting the server all starts ok, bun not restarting. start and stop httpd not working too :(

command systemctl restart httpd works fine
Top

vikhyat
Posts: 91
Joined: Wed Sep 14, 2016 5:39 pm

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by vikhyat » Mon Mar 27, 2017 10:18 am

try rebuilding all users.

and post output of this command

Code: Select all

nginx -t -c /etc/nginx/nginx.conf
Top

drcrash
Posts: 8
Joined: Thu Aug 04, 2016 11:16 am

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by drcrash » Tue Mar 28, 2017 3:56 pm

vikhyat wrote:try rebuilding all users.

and post output of this command

Code: Select all

nginx -t -c /etc/nginx/nginx.conf
I rebuild all users and still have problem with HTTPD service

Code: Select all

[root@web ~]# nginx -t -c /etc/nginx/nginx.conf
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Top

drcrash
Posts: 8
Joined: Thu Aug 04, 2016 11:16 am

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by drcrash » Sun Apr 02, 2017 6:02 pm

Can anyone show /etc/rc.d/init.d/httpd for centos 7, apache 2.4.6?
mine is empty :(
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by skamasle » Sun Apr 02, 2017 6:58 pm

Centos 7 use systemd so you not have /etc/init.d/httpd this is not used
Top

lex0013
Posts: 36
Joined: Tue Oct 28, 2014 9:26 am
Contact:
Contact lex0013
Website Facebook

Os: CentOS 6x
Web: apache + nginx
Re: NGINX and HTTPD not starting at reboot
  • Quote

Post by lex0013 » Wed Jun 02, 2021 9:23 am

dpeca wrote: ↑
Wed Dec 28, 2016 2:06 am
Try to add to /etc/rc.local these lines:

Code: Select all

sleep 3
service nginx restart
service nginx httpd
Yes, it works wonderfully for Centos 8
Can be executed on the command line.

Code: Select all

echo "sleep 3 && systemctl restart nginx  && systemctl restart httpd" >> /etc/rc.local
Top


Post Reply
  • Print view

10 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password