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

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

8 Answers

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.

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. ferdinand@ferdinand-desktop:~$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful ferdinand@ferdinand-desktop:~$ 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

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;

answered Sep 29 '15 at 4:19
Arvind Bhardwaj

3,94822337
 

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.

answered Mar 28 '14 at 15:44
 

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

answered Aug 8 '13 at 11:33
zloboid

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

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...)

answered Mar 18 '16 at 10:14
 

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

answered Feb 15 at 5:37
Zahid Rahman

6691617
 

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,

answered Jul 21 '14 at 19:40
Kousha

5,078854105
 

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.

answered Nov 21 '14 at 17:22
Teemu Leisti

3,38622032
 

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

  1. Error message when you try to modify or to delete an alternate access mapping in Windows SharePoint Services 3.0: "An update conflict has occurred, and you must re-try this action"

    Article ID: 939308 - View products that this article applies to. Expand all | Collapse all Symptoms ...

  2. Parser Error Message: Access is denied【转】

    PRB: Access Denied Error When You Make Code Modifications with Index Services Running View products ...

  3. 记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson

    接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发.然后根据错误信息发现json格式的某个字段为null,结合日志中的报文 ...

  4. Compiler Error Message: CS0016: Could not write to output file 回绝访问

    Compiler Error Message: CS0016: Could not write to output file 'c:\Windows...dll' 拒绝访问 C:\Windows\Te ...

  5. 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: "OCIEnvCre ...

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

    asp.net 的Webproject 项目是在64bit机上开发,默认选项发布后,部署到32bit的服务器上,出现Parser Error Message: Could not load type的 ...

  7. [BTS] The adapter "SQL" raised an error message. Details "The Messaging Engine is shutting down. ".

    Get a warning in event log. Log Name:      ApplicationSource:        BizTalk ServerDate:          3/ ...

  8. Fix the “No Private Key” Error Message

    This article will show you how to correct the “No Private Key” error message in Windows Internet Inf ...

  9. undefined reference to typeinfo - C++ error message

    undefined reference to typeinfo - C++ error message There are some compiler and loader error message ...

随机推荐

  1. Android中破解应用签名校验的后续问题处理方案(闪退和重启现象以及无效问题)

    一.前言 之前已经写了一个爆破签名校验的工具kstools,很多同学也在使用,但是也反馈了不少问题,之前一篇文章也介绍了,关于爆破之后第三方登录问题修复,这篇我们在综合说明一下一些后遗症问题,关于ks ...

  2. 使用tr1的bind函数模板

    最近把公司的VS2008统一升级为SP1了,虽然还是有些跟不上时代,毕竟C++17标准都出了,但是,对于成熟的商业软件开发而言,追求更新的C++标准肯定不是正道.升级SP1的VS2008可以支持TR1 ...

  3. MySQL基础(《MySQL必知必会》简单总结)

    使用MySQL # 选择数据库 USE database_name; # 显示数据库 SHOW DATABASES; # 显示当前数据库的表 SHOW TABLES; # 显示特定表有哪些列 SHOW ...

  4. xcopy 提示文件 还是目录

    xcopy /y a.jpg .\pics\b.jpg很多次,但xcopy总是问我“文件名还是目录名”gg了一下,发现答案可以这样通过管道来做echo f | xcopy /y a.jpg .\pic ...

  5. 每天一个linux命令:【转载】touch命令

    linux的touch命令不常用,一般在使用make的时候可能会用到,用来修改文件时间戳,或者新建一个不存在的文件. 1.命令格式: touch [选项]... 文件... 2.命令参数: -a    ...

  6. Set集合学习

    Java中的Set主要有:HashSet.TreeSet.LinkedHashSet. 一:HashSet HashSet 是一个没有重复元素的无序集合. HashSet由HashMap实现的,不保证 ...

  7. XML专题:使用NSXMLParser解析xml文件

    使用NSXMLParser解析xml文件 1. 设置委托对象,开始解析     NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data ...

  8. 《DSP using MATLAB》示例Example 8.26

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  9. cmd连接mysql操作命令

    连接:mysql -h主机地址 -u用户名 -p用户密码 (注:u与root可以不用加空格,其它也一样)断开:exit (回车) 创建授权:grant select on 数据库.* to 用户名@登 ...

  10. numpy 的三角函数运算

    numpy 的三角函数运算 cos, cosh, sin sinh, tan, tanh regular 和 hyperbolic 三角函数 arccos, arccosh, arcsin, arcs ...