'sudo nginx -s reload' and 'nginx -t' started to need a minute to complete
Maxim Dounin
mdounin at mdounin.ru
Tue Dec 14 01:28:14 MSK 2010
Hello!
On Mon, Dec 13, 2010 at 08:57:04PM +0000, Mark Alan wrote:
> While using Ubuntu 10.10+Nginx0.9.3+php5-fpm 5.3.3-1ubuntu9.1:
>
> Do you know of any reason for 'sudo nginx -s reload' and 'nginx -t'
> suddenly start needing almost a minute to complete?
>
>
> while using:
> server {
> listen example.org:80;
> server_name www.example.org .example.com 192.168.2.18;
> rewrite ^(.*) http://example.org$1 permanent;
> }
> server {
> listen example.org:80 default_server;
> server_name example.org;
> .../...
>
> $ time sudo nginx -s reload
> real 0m0.354s
> user 0m0.336s
> sys 0m0.012s
>
>
> after adding:
> server {
> listen example.com:80;
> server_name www.example.com;
> rewrite ^(.*) http://example.com$1 permanent;
> }
> server {
> listen example.com:80;
> server_name example.com;
> .../...
>
> $ time sudo nginx -s reload
> real 0m56.152s
> user 0m0.077s
> sys 0m0.016s
Most likely reason is example.com having problems with DNS
servers.
While reading/parsing configuration (which is done by both nginx
-t and nginx -s reload) nginx will try to resolve names in listen
directive. If it takes a while you'll see large delays, exactly
as in your case.
Note that host names in proxy_pass directive are resolved as well,
so names there may delay loading as well.
[...]
> $ cat /etc/hosts
> 127.0.0.1 localhost
> 192.168.2.17 mail.example.com example.com www.example.com example.org
> www.example.org
> 192.168.2.18 mail.example.tld example.tld www.example.tld
You may want to check spelling for "example.com" here and in nginx
config.
Maxim Dounin
More information about the nginx
mailing list