Eugeny / ajenti-v

Virtual Hosting addon for Ajenti
ajenti.org/#product-ajenti-v
MIT License
225 stars 80 forks source link

nginx restart failed #51

Closed ternes3 closed 10 years ago

ternes3 commented 10 years ago

hi, when i create a website, i get an error when i restart nginx. [FAIL] Restarting nginx: nginx failed! nginx -t:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

website config:

#AUTOMATICALLY GENERATED - DO NO EDIT!

server {
    listen *:80 ;

    server_name treevo.de;

    access_log /var/log/nginx/treevode.access.log;
    error_log /var/log/nginx/treevode.error.log;

    root /var/www/treevode;
    index index.html index.htm index.php;

    location / {
        return 503;
        error_page 503 @maintenance;
    }

    location @maintenance {
        root /var/lib/ajenti/plugins/vh/extras;
        rewrite ^(.*)$ /maintenance.html break;
    }

}

after i delete the website nginx restart with "ok".

Eugeny commented 10 years ago

Can you please check /var/log/nginx/error.log?

ternes3 commented 10 years ago

it is a bind error:

2014/03/24 14:11:45 [emerg] 10866#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/03/24 14:11:45 [emerg] 10866#0: still could not bind()

i know how i can fix it, but i think it is also an misstake in ajenti-v.

Eugeny commented 10 years ago

Looks like port 80 is taken by other application (check with sudo netstat -tlnp | grep 80) - maybe it's Apache?

ternes3 commented 10 years ago

apache is not installed.

root@v22013051598612672:/etc/nginx/conf.d# sudo netstat -tlnp | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      9634/nginx      
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      9498/python 
Eugeny commented 10 years ago

try:

kill 9634
service nginx stop
service nginx start
ternes3 commented 10 years ago

thanks, this work.

beeep commented 10 years ago

Hi, i have the same problem. But Nginx starts! When i try service nginx start, there are no errors in the terminal. My error.log:

2014/04/18 17:10:06 [emerg] 2983#0: bind() to MY_IP:80 failed (98: Address already in use)

2014/04/18 17:10:06 [emerg] 2983#0: still could not bind()

2014/04/18 17:10:13 [emerg] 2983#0: bind() to MY_IP:80 failed (98: Address already in use)

2014/04/18 17:10:13 [emerg] 2983#0: still could not bind()

Port 80: tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 922/nginx tcp 0 0 46.38.234.191:8000 0.0.0.0:* LISTEN 027/python

When i try kill 922, it says: -bash: kill: (922) - No such process.

When i open the domain:

The following error was encountered while trying to retrieve the URL: http://MY_DOMAIN.TLD/ Unable to determine IP address from host name MY_DOMAIN.TLD The DNS server returned: Server Failure: The name server was unable to process this query. This means that the system was not able to resolve the hostname presented in the URL. Check if the address is correct.

What can I do?

ternes3 commented 10 years ago

You can search for the right process name with top or just reboot your server

mfg ternes3

2014-04-18 17:37 GMT+02:00 beeep notifications@github.com:

Hi, i have the same problem. But Nginx starts! When i try service nginx start, there are no errors in the terminal. My error.log:

2014/04/18 17:10:06 [emerg] 2983#0: bind() to 46.38.234.191:80 failed (98: Address already in use)

2014/04/18 17:10:06 [emerg] 2983#0: still could not bind()

2014/04/18 17:10:13 [emerg] 2983#0: bind() to 46.38.234.191:80 failed (98: Address already in use)

2014/04/18 17:10:13 [emerg] 2983#0: still could not bind()

Port 80: tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 922/nginx tcp 0 0 46.38.234.191:8000 0.0.0.0:* LISTEN 027/python

When i try kill 922, it says: -bash: kill: (922) - No such process.

What can I do?

— Reply to this email directly or view it on GitHubhttps://github.com/Eugeny/ajenti-v/issues/51#issuecomment-40817912 .

beeep commented 10 years ago

Ok, Nginx is started now, thanks! But my website doesn't work. Same error message.

but why the ip of my computer is in the access log? i can't open the website.

jadsonlourenco commented 10 years ago

See if there is more than one site with the same IP, for me when I add a specific IP for each site that happens, then I usually leave "*" in the IP configuration of each site in ajenti-v-ngnix.

then restart nginx (you can do the main screen of "websites" in ajenti)

Eugeny commented 10 years ago

@beeep,

Unable to determine IP address from host name MY_DOMAIN.TLD

means that your DNS entry isn't configured properly (or you're using a wrong URL)

beeep commented 10 years ago

My configuration for the domain in ajenti is:

Host Port SSL SPDY Default (star) * 80 No No Yes

And my configuration for my domain at my domain provider is: x Use my own DNS Service Hostname: my hostname ip: n/a

Eugeny commented 10 years ago

Does the x mean that Use my own DNS Service is selected?

Eugeny commented 10 years ago

If you use Use my own DNS Service, you should setup BIND accordingly on your host.

wrrr commented 10 years ago

Note (possibly unrelated): I see this if I initiate a new domain and leave "Maintenance Mode" checked. Once I un-check, Nginx restarts gracefully.

Eugeny commented 10 years ago

@wrrr, you can check for NGINX config errors in the Configuration Tests list

raitucarp commented 10 years ago

hello @Eugeny I think you should rewrite nginx configuration with 80 not *:80, cmiiw

Eugeny commented 10 years ago

@raitucarp *:80 is absolutely identical to 80

raitucarp commented 10 years ago

Ok