Nginx not running with no error message

Nginx not running with no error message

#!/bin/sh
echo "start"
rm /etc/nginx/sites-enabled/default
ln -s /primerbean/nginx_conf/healthbean_nginx.conf /etc/nginx/sites-enabled/
/etc/init.d/nginx start
echo `service nginx status`
echo `service apache2 status`
service nginx restart
echo `service nginx status`
cat /var/log/nginx/error.log
uwsgi --ini /primerbean/nginx_conf/healthbean_uwsgi.ini
# migrate db, so we have the latest db schema
# python manage.py migrate
# start development server on public ip interface, on port 8000
# python manage.py runserver 0.0.0.0:8000

Ask Question


up vote56down votefavorite

19

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

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 /etc/nginx/sites-available/default file :

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;
  }
}

nginx


shareimprove this question

edited Jul 25 ‘13 at 15:42

Charles

43.1k1180118

asked Jul 25 ‘13 at 13:38

user2618928

281134

 

3  

Did you try service nginx configtest ? – Tim Baas Jul 25 ‘13 at 13:40
    

Using this command give me this answer : "Testing nginx configuration: nginx." – user2618928 Jul 25 ‘13 at 13:44 
3  

And "sudo nginx -t" gives me : nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful – user2618928 Jul 25 ‘13 at 13:46
1  

Did you also try starting nginx with sudo? – Tim Baas Jul 25 ‘13 at 13:47
    

I am always starting it with sudo, otherwise I get an error of permission denied when it tries to acces the error.log file – user2618928 Jul 25 ‘13 at 13:49

show 2 more comments

8 Answers

activeoldestvotes


up vote174down vote

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

I ran into the same problem. The reason I had the issue was twofold. First, I had accidentally copied a log file into my site-enabled folder. I deleted the log file and made sure that all the files in sites-enabled were proper nginx site configs. I also noticed two of my virtual hosts were listening for the same domain. So I made sure that each of my virtual hosts had unique domain names.

sudo service nginx restart

Then it worked.


shareimprove this answer

edited Dec 21 ‘13 at 8:38

Jay Mayu

9,4842595133

answered Oct 29 ‘13 at 20:21

badmadrad

1,953176

 

53  

sudo nginx -t is an awesome tip :) – Jay Mayu Dec 21 ‘13 at 8:38
1  

As you(@badmadrad) said I got the following by running sudo nginx -t.but still when I try to restart it fail. [email protected]:~$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [email protected]:~$ sudo service nginx restart * Restarting nginx nginx [fail] – Ferdinand Rosario Aug 4 ‘14 at 11:36 
    

make sure your site-enabled only has nginx conf files in there. Also make sure there is no port conflict when starting nginx. – badmadrad Sep 23 ‘14 at 17:15

add a comment


up vote8down vote

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

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


shareimprove this answer

answered Sep 29 ‘15 at 4:19

Arvind Bhardwaj

3,94822337

 
add a comment

up vote4down vote

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

Notice the missing s in site.


shareimprove this answer

edited Apr 9 ‘14 at 17:07

answered Mar 28 ‘14 at 15:44

DanielBlanco

513

 
add a comment

up vote3down vote

Check the daemon option in nginx.conf file. It has to be ON. Or you can simply rip out this line from config file. This option is fully described here http://nginx.org/en/docs/ngx_core_module.html#daemon


shareimprove this answer

answered Aug 8 ‘13 at 11:33

zloboid

313

 

    

This was it. Thank you! – Alex Jul 5 ‘14 at 9:05

add a comment


up vote1down vote

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

2. Check for port conflicts. For instance, if apache2 (ps waux | grep apache2) or any other service is using the same ports configured for nginx (say port 80) the service will not start and will fail silently (err... the cousin of my friend had this problem...)


shareimprove this answer

answered Mar 18 ‘16 at 10:14

gtamorim

508

 
add a comment

up vote1down vote

One case you check that nginx hold on 80 number port in system by default , check if you have any server like as apache or anything exist on system that block 80 number port thats the problem occurred.

1 .You change port number on nginx by this way,

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

Change 80 to 81 or anything,

  1. Check everything is ok by ,

sudo nginx -t

  1. Restart server

sudo service nginx start

  1. Check the status of nginx:

sudo service nginx status

Hope that will work


shareimprove this answer

answered Feb 15 at 5:37

Zahid Rahman

6691617

 
add a comment

up vote0down vote

I had the exact same problem with my instance. My problem was that I forgot to allow port 80 access to the server. Maybe that‘s your issue as well?

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


shareimprove this answer

answered Jul 21 ‘14 at 19:40

Kousha

5,078854105

 
add a comment

up vote0down vote

For what it‘s worth: I just had the same problem, after editing the nginx.conf file. I tried and tried restarting it by commanding sudo nginx restart and various other commands. None of them produced any output. Commanding sudo nginx -t to check the configuration file gave the output sudo: nginx: command not found, which was puzzling. I was starting to think there were problems with the path.

Finally, I logged in as root (sudo su) and commanded sudo nginx restart. Now, the command displayed an error message concerning the configuration file. After fixing that, it restarted successfully.


shareimprove this answer

answered Nov 21 ‘14 at 17:22

Teemu Leisti

3,38622032

 
add a comment
时间: 2024-08-30 09:29:01

Nginx not running with no error message的相关文章

Parser Error Message: Access is denied【转】

PRB: Access Denied Error When You Make Code Modifications with Index Services Running View products that this article applies to. Article ID : 329065 Last Review : June 25, 2004 Revision : 3.0 This article was previously published under Q329065 SYMPT

{"error":"{\"error\":{\"message\":\"发送新鲜事超过配额。\",\"code\":\"forbidden.FEED_PUBLISH_QUOTA_LIMIT_REACH

今天做 人人的分享的时候遇到: "{"error":"{\"error\":{\"message\":\"发送新鲜事超过配\",\"code\":\"forbidden.FEED_PUBLISH_QUOTA_LIMIT_REACHEL\"}}","status":403}" 原因: 是因为 我的人人的账户:  两天只能  发送

Citrix 核心服务器报错Error: IMA Service Error Message -2147483647

ima服务不能启动的问题Error: IMA Service Error Message -214748364 http://support.citrix.com/article/CTX032712 可能是C:\Program Files\Citrix\Independent Management Architecture\ imalhc.mdb文件坏了,先删除这个文件.然后运行dsmaint recreatelhc重新创建这个文件.再重新启动机器或者服务,应该可以解决此问题. 日常要备份c:\

Oracle Error - "OCIEnvCreate failed with return code -1 but error message text was not available".

ISSUE: When trying to connect to an Oracle database you receive the following error: "OCIEnvCreate failed with return code -1 but error message text was not available" CAUSE: 以下两种情况之一是可能的原因: 1,你在 Windows 7 上使用不支持的版本的 Oracle 客户端 (超过 11.2). 2,从以前安

False 'Sharing Violation' Xcopy error message

今天想要将QC的新工具自动拷贝到p4 用户机器上使用,为了避免每次通知大家升级啊!!! 于是,我在程序里调用了bat文件,执行拷贝操作,想在默默的情况下替换更新新版本工具,结果我测试发现没能成功更新版本,于是去看log,发现拷贝exe文件的时候报错:Sharing Violation 网上查了很多资料,说的最多的是.拷贝权限问题~~~ 例如:  B -->A.  通常是A处目标不可写,或者B处文件不可读. 查了文件后发现不存在该问题. 当我手动执行bat文件,拷贝顺利进行~~~ 如此诡异~~~

ASP.NET Parser Error Message: Could not load type 'Web.Global'.

Server Error in '/myapp' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. P

Pylint Error Message: “E1101: Module 'xxx' has no 'xxx' member'”

原因:Pylint默认只信任来自标准库stdlib的C扩展,而忽略其他的.模块'xxx'不是stdlib的一部分,需要手动将其添加到白名单. 解决方案: 在terminal里 (例如Windows 平台的powershell)导航到项目所在目录: 为Pylint生成rcfile文件: 1 pylint --generate-rcfile > .pylintrc 打开生成的文件.pylintrc,将模块名添加至白名单:extension-pkg-whitelist=xxx.以 lxml为例,结果为

网站部署后Parser Error Message: Could not load type 的解决方案

asp.net 的Webproject 项目是在64bit机上开发,默认选项发布后,部署到32bit的服务器上,出现Parser Error Message: Could not load type的错误,主要原因是: 解决方案的编译配置默认情况下是Debug状态,将其切换到All Configurations下,并将目标平台选为Any CPU,重新发布,就能成功,具体操作如下: 右键解决方案--属性,如图配置

安装 ORACLE 11G出现Error Message:PRVF-7535

Error Message:PRVF-7535 : Proper architectureis not found on node "tsing" [Expected = "x86" ; Found ="x86_64"] INFO: Cause: System architecture does not meet the requirement. INFO: Action: Ensure that the correct software bu.