/etc/init.d/nginx start", the message "Starting nginx...">

Nginx not working without error message

I am trying to start my nginx server. When I type "$> /etc/init.d/nginx start", the message "Starting nginx:" appears and then nothing happens. There is no error message, and when I check the status of nginx, I see that it does not work.

Here is my /etc/nginx/nginx.conf file:

worker_processes 4; daemon off; error_log /home/vincent/tmp/nginx.log; pid /home/vincent/tmp/nginx.pid; events { worker_connections 1024; } http { default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /home/vincent/tmp/access.log main; sendfile on; keepalive_timeout 65; include /etc/nginx/site-enabled/*; 

}

And here is my file / etc / nginx / sites -available / default:

 server { listen 80; server_name technical-test.neo9.lan; access_log /var/log/nginx/technical-test.neo9.lan.log main; set $home /home/vincent; location / { alias $home/neo9/web/app/; index index.html; } location /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://localhost:1234; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } 
+56
nginx
Jul 25 '13 at 13:38
source share
8 answers

First, always sudo nginx -t to verify that your configuration files are good.

I ran into the same problem. The reason I had a problem was twofold. Firstly, I accidentally copied a log file to a site support folder. I deleted the log file and made sure that all the files with the sites included were the correct nginx site configurations. I also noticed that my two virtual hosts were listening on the same domain. Therefore, I made sure that each of my virtual hosts has unique domain names.

sudo service nginx restart

Then he worked.

+175
Oct 29 '13 at 20:21
source share

You should probably check for errors in /var/log/nginx/error.log .

In my case, I did not add a port for ipv6. You should also do this (if you are using nginx on a port other than 80): listen [::]:8000 default_server ipv6only=on;

+8
Sep 29 '15 at 4:19
source share

In your /etc/nginx/nginx.conf file you have:

 include /etc/nginx/site-enabled/*; 

And probably the path you are using is:

 /etc/nginx/sites-enabled/default 

Pay attention to the missing s on the site.

+4
Mar 28 '14 at 15:44
source share

Check the daemon parameter in the nginx.conf file. It must be turned on. Or you can simply snatch this line from the configuration file. This option is fully described here http://nginx.org/en/docs/ngx_core_module.html#daemon

+3
Aug 08 '13 at 11:33
source share

1. Check your configuration files by running the above command: sudo nginx -t .

2. Check for port conflicts. For example, if apache2 ( ps waux | grep apache2 ) or any other service uses the same ports configured for nginx (for example, port 80), the service will not start and will fail (error ... my friend's cousin had this problem...)

+1
Mar 18 '16 at 10:14
source share

In one case, you check that nginx holds the 80-port port in the system by default, check if you have any server like apache or something else on the system where port number 80 is located. This problem has occurred.

1. This way you change the port number to nginx,

sudo vim / etc / nginx / sites-available / default

Change the value of 80 to 81 or something else

  1. Check everything is alright

sudo nginx -t

  1. Restart server

sudo service nginx start

  1. Check nginx status:

sudo service nginx status

Hope it works

+1
Feb 15 '17 at 5:37
source share

I had the same problem with my instance. My problem was that I forgot to allow port 80 access to the server. Maybe your problem?

Check your WHM and make sure the port is open for the IP address of your site,

0
Jul 21 '14 at 19:40
source share

What it costs: I had the same problem after editing the nginx.conf file. I tried to restart it by running the sudo nginx restart command and various other commands. None of them produced any products. The sudo nginx -t command to check the configuration file gave the result sudo: nginx: command not found , which was puzzled. I was starting to think that there were problems with this path.

Finally, I logged in as root ( sudo su ) and commanded sudo nginx restart . The command now displays an error message regarding the configuration file. After fixing it, it restarted successfully.

0
Nov 21 '14 at 17:22
source share



All Articles