• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 138
  • Last Modified:

regarding issue with Nginx exited with code 0

Hi experts,

when I run nginx, I get error,
nginx exited with code 0

nginx is started from npm run scripts

I had run $sudo npm run start-prod
scripts:
start-prod: has the following command

concurrently --no-color "uwsgi --emperor code/uwsgi.ini --uid www-data gid www-data" "nginx"  "npm run render-prod"

npm run render-prod value of script is
 "render-prod": "babel-node node/react-render.jsx"

[0] *** Starting uWSGI 2.0.15 (64bit) on [Thu Feb 15 06:06:34 2018] ***
[0] compiled with version: 5.4.0 20160609 on 09 February 2018 02:01:25
[0] os: Linux-4.4.0-1049-aws #58-Ubuntu SMP Fri Jan 12 23:17:09 UTC 2018
[0] nodename: ip-10-244-152-179
[0] machine: x86_64
[0] clock source: unix
[0] pcre jit disabled
[0] detected number of CPU cores: 8
[0] current working directory: /home/ubuntu/bharath/sourcecode/projects/NTDL/ntdl
[0] detected binary path: /usr/local/bin/uwsgi
[0] setgid() to 33
[0] setuid() to 33
[0] *** WARNING: you are running uWSGI without its master process manager ***
[0] your processes number limit is 60090
[0] your memory page size is 4096 bytes
[0] detected max file descriptor number: 1048576
[0] *** starting uWSGI Emperor ***
[1] nginx exited with code 0
[2]
[2] > ntdl@1.0.2 render-prod /home/ubuntu/bharath/sourcecode/projects/NTDL/ntdl
[2] > babel-node node/react-render.jsx
[2]
[0] *** has_emperor mode detected (fd: 5) ***
[0] [uWSGI] getting INI configuration from code/uwsgi.ini
[0] *** Starting uWSGI 2.0.15 (64bit) on [Thu Feb 15 06:06:34 2018] ***
[0] compiled with version: 5.4.0 20160609 on 09 February 2018 02:01:25
[0] os: Linux-4.4.0-1049-aws #58-Ubuntu SMP Fri Jan 12 23:17:09 UTC 2018
[0] nodename: ip-10-244-152-179
[0] machine: x86_64
[0] clock source: unix
[0] pcre jit disabled
[0] detected number of CPU cores: 8
[0] current working directory: /home/ubuntu/bharath/sourcecode/projects/NTDL/ntdl
[0] detected binary path: /usr/local/bin/uwsgi
[0] chdir() to /home/ubuntu/bharath/sourcecode/projects/NTDL/ntdl/
[0] your processes number limit is 60090
[0] your memory page size is 4096 bytes
[0] detected max file descriptor number: 1048576
[0] lock engine: pthread robust mutexes
[0] thunder lock: disabled (you can enable it with --thunder-lock)
[0] uwsgi socket 0 bound to UNIX address /tmp/ntdl.sock fd 3
[0] Python version: 3.5.2 (default, Nov 23 2017, 16:37:01)  [GCC 5.4.0 20160609]
[0] Python main interpreter initialized at 0x1147f80
[0] python threads support enabled
[0] your server socket listen backlog is limited to 100 connections
[0] your mercy for graceful operations on workers is 60 seconds
[0] mapped 537088 bytes (524 KB) for 20 cores
[0] *** Operational MODE: threaded ***
[0] WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x1147f80 pid: 14263 (default app)
[0] *** uWSGI is running in multiple interpreter mode ***
[0] spawned uWSGI master process (pid: 14263)
[0] Thu Feb 15 06:06:35 2018 - [emperor] vassal code/uwsgi.ini has been spawned
[0] spawned uWSGI worker 1 (pid: 14296, cores: 20)
[0] Thu Feb 15 06:06:35 2018 - [emperor] vassal code/uwsgi.ini is ready to accept requests
[2] React render server listening at http://0.0.0.0:9009

nginx exited with code 0

now it has created the sock for uwsgi server. and uwsgi server is running now.  my doubt is whether nginx is running or not?

secondly, I am running this under aws ubuntu.  

How will I  see it in the browser.  Do I had to provide proxy_set_header set to X-Forwarded-Host "54.206.154.95" something like this to see in browser and it value to an ip address in the nginx.conf file

 
Please help in fixing this error.

TIA.

With regards.

Bharath AK
0
Bharath A.K
Asked:
Bharath A.K
1 Solution
 
nociSoftware EngineerCommented:
exit 0 means successfull exit, for what ever call was done.

nginx can also be started to validate if the config file is safe to use, (here the short summary).
$ nginx -h
nginx version: nginx/1.12.2
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -T            : test configuration, dump it and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /usr/)
  -c filename   : set configuration file (default: /etc/nginx/nginx.conf)
  -g directives : set global directives out of configuration file


so a call: nginx -f someconfig.cfg -t
will check if a config file is usable, and exit 0 if ok, and exit 1 if fail.

So what were the commands actualy given..?
it could very well be a nginx -s reload    to tell a running server to reload a config.

I will assume a linux system based on info above:

ps -ax | grep nginx | grep -v grep

should show a few lines if nginx is running
at least an nginx: master process and probably some nginx: worker processes.
0
 
Bharath A.KAuthor Commented:
Hi Noci,

       Thanks for your reply.  I happy that nginx is running.    I stopped by ctrl-c to go command prompt and checked ps-as |grep nginx | grep -v grep.  I had seen two process master and worker process running.  my next step is to see it in browser.  I am running in ubuntu aws.  I am accessing this ubuntu from windows laptop machine through ssh using putty, by providing an Ip address.

How will i see this in browser?  Do I had to provide proxy_set_header set to X-Forwarded-Host "54.206.154.95" in nginx.conf something like this to see it in browser.  Please suggest me how can see it in browser.

With Many thanks,
Bharath AK
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now