之前直接用
sudo apt-get install nginx
安装的 然后又被我参考这个链接卸载掉了 http://luowei010101.blog.163.com/blog/static/2035660802013415025883/ 然后我又根据这个链接 http://simple-is-better.com/news/756 按照这个指令安装了较新版本的nginx
sudo add-apt-repository ppa:nginx/stable
apt-get update
apt-get install nginx
之后就出现一个诡异的现象 就是nginx再也无法使用
sudo /etc/init.d/nginx start
这个指令启动了
sudo /etc/init.d/nginx restart
也不行了 但是
sudo /etc/init.d/nginx stop
却是可以的
这里指的不行就是
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx restart
输入这两句指令之后 然后回车 然后什么都没有输出或者发生什么 就是什么也没有
然后进入浏览器也无法访问http://localhost 求问各位大大 是什么情况 实在不行重装ubuntu了
在/var/logs/nginx/error.log 中记录的错误日志如下
2013/08/28 23:02:01 [emerg] 9161#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:02:05 [emerg] 9168#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:02:20 [emerg] 9200#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:03:13 [emerg] 9212#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:03:40 [emerg] 9235#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:05:46 [emerg] 9299#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:09:20 [emerg] 9376#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:42:08 [emerg] 2382#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:47:39 [emerg] 3250#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/28 23:49:44 [emerg] 3422#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/29 07:45:48 [emerg] 6276#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/29 07:45:52 [emerg] 6283#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
2013/08/30 09:59:17 [emerg] 13070#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default~:21
用bash ps aux | grep nginx
查看是否有进程占用 发现的确有一个 但是无法用kill -9 中断那个进程
bash netstat -tnlp | grep nginx
产看 什么也没有 这两个指令的结果贴在下面了
用root权限查看端口占用依然啥也没有 如下图
Looking at the log prompts, it seems that your configuration file defines two servers that use port 80, but are not bound to server_name.
Check whether the nginx process is running
$ ps aux | grep nginx
Check whether nginx is listening on port 80 or other ports you set
$ netstat -tnlp | grep nginx
Whether there is an error in the configuration. Generally, the failure to get up is due to inaccurate configuration of a certain section.
nginx -t Try to see if it is a problem in the configuration file.