LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-08-2019, 01:31 PM   #1
jangboing
LQ Newbie
 
Registered: May 2015
Posts: 3

Rep: Reputation: Disabled
Question Systemd not starting Nginx properly on Debian 9


Hello,

I'm having some trouble with Systemd and I was wondering if I could get some advice.

I have Nginx set to bind to an IP address. The problem with this configuration is that it doesn't start automatically on boot, but can be started manually afterward. I believe the issue is that Systemd is trying to start Nginx too early, and network configuration hasn't finished.

I've created an override unit file for Nginx that specifies "After=network-online.target" and "Wants=network-online.target", but that doesn't seem to help.

Does anyone have any idea about what might be going wrong? Just to make sure that I don't have something else that's causing the issue, I started another Debian 9 VPS to try it but I run into the same problem.


Thanks.
 
Old 04-08-2019, 07:12 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
It would be great if you posted a few more details, such as error messages.
 
Old 04-08-2019, 10:17 PM   #3
jangboing
LQ Newbie
 
Registered: May 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
It would be great if you posted a few more details, such as error messages.
I had a look at Syslog and this is what it says:

Code:
Apr  8 18:07:49 localhost nginx[681]: nginx: [emerg] bind() to [RemovedIPV6]:80 failed (99: Cannot assign requested address)
Apr  8 18:07:49 localhost nginx[681]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr  8 18:07:49 localhost systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr  8 18:07:49 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Apr  8 18:07:49 localhost systemd[1]: nginx.service: Unit entered failed state.
Apr  8 18:07:49 localhost systemd[1]: nginx.service: Failed with result 'exit-code'.

Just to confirm that binding to IPv6 is the issue, I removed that part from the configuration file and it worked perfectly. It looks like the IPv6 address isn't available even when Systemd reaches the "Network is Online" target.

I guess I could roll without IPv6 but I'm still curious about why it isn't available during boot.


Thanks for responding.
 
Old 04-11-2019, 02:01 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
iirc, there's an additional service called "network-wait-online", which needs to be activated, and then you need to make nginx depend on that.
 
Old 04-27-2019, 04:06 PM   #5
slayerking
Member
 
Registered: Apr 2011
Posts: 60

Rep: Reputation: 3
Quote:
Apr 8 18:07:49 localhost nginx[681]: nginx: configuration file /etc/nginx/nginx.conf test failed
There is something wrong with your config. Post your config file

Quote:
cat /etc/nginx/nginx.conf
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx + php-fpm and nginx modules fantasygoat Linux - Server 0 06-09-2011 12:21 PM
LXer: Nginx+Varnish compared to Nginx LXer Syndicated Linux News 0 04-27-2011 02:30 PM
Nginx experts help me-problem when using Nginx php-fpm !!! HuMan-BiEnG Linux - Server 2 04-17-2011 02:30 PM
NGINX with PHP-FPM vis NGINX with Spawn-FCGI WhisperiN Linux - Server 1 03-15-2011 06:39 PM
[SOLVED] Starting File System .. Starting File System .. Starting File System .. Starting File rmknox Linux - Newbie 3 08-15-2010 11:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration