1

我将 nginx 用于 uniq 应用程序,然后按照本教程显示的步骤进行了更改并配置了服务器块(AKA Vhost-in apache) (参见教程)

服务器工作(仅使用service gninx restart)直到我重新启动 VPS

现在 NGINX 没有启动并且没有显示输出消息 (尝试了所有启动方式)

我错过了什么?

$ /etc/init.d/nginx status 返回:

 * nginx is not running

Diggin 从我的本地机器返回

$ dig http://www.xx.com

; <<>> DiG 9.8.1-P1 <<>> http://www.xx.com
;; global options: +cmd
;; connection timed out; no servers could be reached

(在编辑时添加) - - - - - - - - - - - 对于我的其他域

; <<>> DiG 9.8.1-P1 <<>> http://www.xx.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 5145
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;http://www.xx.com  IN  A

;; AUTHORITY SECTION:
xx.com .    900 IN  SOA

;; Query time: 39 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jun  4 21:01:55 2013
;; MSG SIZE  rcvd: 110

卷曲时:

curl http://www.xx.com -v
* About to connect() to www.xx.com port 80 (#0)
*   Trying 198.199.199.155... Conexão recusada*
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

* (拒绝连接)

ping 结果: 33 packets transmitted, 33 received, 0% packet loss, time 197754ms


我的配置:

我已将我的域添加到/etc/hosts

127.0.0.1       localhost xx
198.199.199.155 www.xx.com
198.199.199.155 xx.com
198.199.199.155 www.yy.com
198.199.199.155 yy.com

在我的/etc/nginx/nginx.conf

worker_processes 1;
user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
  worker_connections 1024;
  accept_mutex off;
}
http {
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  access_log /tmp/nginx.access.log combined;
  sendfile on;
  tcp_nopush on;
  tcp_nodelay off;
  gzip on;
  gzip_http_version 1.0;
  gzip_proxied any;
  gzip_min_length 500;
  gzip_disable "MSIE [1-6]\.";
  gzip_types text/plain text/xml text/css
             text/comma-separated-values
             text/javascript application/x-javascript
             application/atom+xml;
  include /etc/nginx/sites-enabled/*;
  ##########################################################
  # Catch all requests to server ip so just hitting the ip
  # won't render anything.
  ##########################################################
 server {
    listen   80 default;
    server_name  anything;
         # Everything is a 404
    location / {
        return 404;
    }
  }
}

- 已编辑 -

ps:IP和域名都是假的-.-'

4

1 回答 1

2

你这里好像有问题:

#server {
    listen   80 default;
    server_name  anything;
    # Everything is a 404
    location / {
        return 404;
    }
}

server被注释掉,但该集中的其他行没有。

如果您打算注释掉整个server块,则需要使用:

#server {
#    listen   80 default;
#    server_name  anything;
#    # Everything is a 404
#    location / {
#        return 404;
#    }
#}
于 2013-06-04T23:54:59.513 回答