简体   繁体   中英

Nginx no longer starts and doesn't give output

I was using nginx for a uniq app, then I changed it and configured for server blocks (AKA Vhost-in apache), following the steps this tuto shows (see the tutorial)

The server worked (just with service gninx restart ) till I reboot the VPS

NOW NGINX ISNT STARTING AND NO OUTPUT MSG is being shown (tried all the start ways)

What am I missing?

$ /etc/init.d/nginx status returns:

 * nginx is not running

Diggin from my local machine returns

$ 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

(added on edit) - - - - - - - -- - - - For my other domain

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

When curl:

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

* (refused connection)

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


My config:

I've added my domains to /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

On my /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;
    }
  }
}

- EDITED -

ps: IP and domains are fakes -.-'

You seem to have a problem here:

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

server is commented out, but the other lines in that set are not.

If you intended on commenting out the entire server block, you'll need to use:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM