Page 1 of 2

nginx restart failed

Posted: Sat Nov 14, 2015 10:11 pm
by juanfree
I received this email alert from vestacp

server.xxx.com: nginx restart failed

Code: Select all

nginx: [emerg] the same path name "/var/cache/nginx/xxx.es" used in /etc/nginx/conf.d/01_caching_pool.conf:2 and in /etc/nginx/conf.d/01_caching_pool.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx: [emerg] the same path name "/var/cache/nginx/xxx.es" used in /etc/nginx/conf.d/01_caching_pool.conf:2 and in /etc/nginx/conf.d/01_caching_pool.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
Any idea of this problem and how to solve it?

regards

Re: nginx restart failed

Posted: Sat Nov 14, 2015 11:18 pm
by Stesh

Code: Select all

cat /etc/nginx/conf.d/01_caching_pool.conf

?

Re: nginx restart failed

Posted: Sun Nov 15, 2015 1:47 am
by juanfree
Stesh wrote:

Code: Select all

cat /etc/nginx/conf.d/01_caching_pool.conf

?

Code: Select all

[root@server ~]# cat /etc/nginx/conf.d/01_caching_pool.conf
proxy_cache_path /var/cache/nginx/xxx.com levels=2 keys_zone=xxx.com:10m inactive=60m max_size=512m;
proxy_cache_path /var/cache/nginx/xxx.es levels=2 keys_zone=xxx.es:10m inactive=60m max_size=512m;

Re: nginx restart failed

Posted: Sun Nov 15, 2015 5:05 am
by skurudo
Check, there is in your config "/var/cache/nginx/xxx.es" and where path repeats twice.

Re: nginx restart failed

Posted: Sun Nov 15, 2015 9:36 am
by juanfree
skurudo wrote:Check, there is in your config "/var/cache/nginx/xxx.es" and where path repeats twice.
Thanks a lot.

Re: nginx restart failed

Posted: Sun Jan 24, 2016 4:57 pm
by abrarahmed
I hope this helps
Open

Code: Select all

/etc/nginx/conf.d/01_caching_pool.conf
and remove all the duplicate lines. And then restart nginx.

Re: nginx restart failed

Posted: Thu Jan 28, 2016 10:49 pm
by erm3nda
Anyone know wich part of the code does that disk write?
Would be good to avoid writing twice a line in that file and avoid crashes.

Re: nginx restart failed

Posted: Mon Feb 08, 2016 6:37 pm
by pandabb
^ YEs everytime i change template and rebuild user nginx stop loading due to the duplicate code below

proxy_cache_path /var/cache/nginx/acentura.com levels=2 keys_zone=...................

How to fix this way no downtime when i change template.

--update i found this on the template i think this is it ? which line of code here

Code: Select all

#!/bin/bash

user=$1
domain=$2
ip=$3
home=$4
docroot=$5

str="proxy_cache_path /var/cache/nginx/$domain levels=2"
str="$str keys_zone=$domain:10m inactive=60m max_size=512m;"
echo "$str" >> /etc/nginx/conf.d/01_caching_pool.conf


Re: nginx restart failed

Posted: Tue Feb 16, 2016 7:20 pm
by skurudo

Re: nginx restart failed

Posted: Wed Feb 17, 2016 11:29 am
by djattitude
The bash script is missing the grep check that the master RHEL version has. you will still need to remove the duplicates so nginx can start again, but once done, rebuilds will no longer create duplicates.

Replace /usr/local/vesta/data/templates/web/nginx/caching.sh with the following;

Code: Select all

#!/bin/bash

user=$1
domain=$2
ip=$3
home=$4
docroot=$5

str="proxy_cache_path /var/cache/nginx/$domain levels=2"
str="$str keys_zone=$domain:10m inactive=60m max_size=512m;"
conf='/etc/nginx/conf.d/01_caching_pool.conf'
if [ -e "$conf" ]; then
    if [ -z "$(grep "=${domain}:" $conf)" ]; then
        echo "$str" >> $conf
    fi
else
    echo "$str" >> $conf
fi
From: http://c.vestacp.com/0.9.8/rhel/nginx-c ... caching.sh

Devs: http://c.vestacp.com/0.9.8/rhel/7/templ ... caching.sh, http://c.vestacp.com/0.9.8/rhel/6/templ ... caching.sh and http://c.vestacp.com/0.9.8/rhel/5/templ ... caching.sh need updating.

Edit: updated bug report. The files used by the installer (eg, c.vestacp.com/0.9.8/rhel/7/templates.tar.gz) contains the out-of-date caching.sh bash script.