We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
-
- Posts: 1
- Joined: Wed May 07, 2014 9:41 pm
VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
Hello , I am trying to install varnish on my website , for me this proving very difficult, follow all steps outlined (and agree ) on all tutorials on the net, but it does not work , in fact or redirects nginx ( because for sure if it works , write : dominio.com and redirects me to www.dominio.com ) . So I have the files:
/ etc / varnish / default.vcl---------------------------------------------------------
( ... )
backend default {
. host = "127.0.0.1 " ;
. port = " 8080" ;
}
( ... )
/ home / admin / conf / web / nginx.conf-------------------------------------------------------------------
server {
listen 123.123.123.123:8080 , < --- IP VPS
server_name domain.com www.domain.com ;
error_log / var / log / httpd / domains / domain.com.error.log mistake ;
location / {
PROXY_PASS http://123.123.123.123:8080 ; ---- << IP VPS
location ~ * ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|exe|pdf|doc|xls|ppt|txt|odt|ods|odp|odf|tar|bmp|rtf|js|mp3|avi|mpeg|flv|html|htm)$ {
root / home / admin / web / estanochefollamos.com / public_html ;
access_log / var / log / httpd / domains / domain.com.log combined ;
access_log / var / log / httpd / domains / domain.com.bytes bytes;
expires max ;
try_files $ uri @ fallback ;
}
}
location / error / {
alias / home / admin / web / domain.com / document_errors / ;
}
location @ fallback {
PROXY_PASS http://123.123.123.123:8080 ;
}
. location ~ / \ ht {return 404; }
. location ~ / \ svn / {return 404; }
. location ~ / \ git / {return 404; }
. location ~ / \ hg / {return 404; }
. location ~ / \ bzr / {return 404; }
include / home / admin / conf / web / nginx.domain.com.conf * ;
}
/ etc / sysconfig / varnish----------------------------------------------------------------
( ... )
DAEMON_OPTS = " -a: 80 \
-T localhost: 6082 \
-f / etc / varnish / default.vcl \
- or varnish - g varnish \
- S / etc / varnish / secret \
- s file , / var / lib / varnish / varnish_storage.bin , 1G "
( ... )
netsat - ntlup----------------------------------------------------------
[root@server1 ~]# netstat -ntlup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 2133/spamd.pid
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 123.123.123.123:8080 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 123.123.123.123:80 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 4239/nginx
tcp 0 0 127.0.0.1:8084 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 123.123.123.123:53 0.0.0.0:* LISTEN 2020/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2020/named
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1577/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 772/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2020/named
tcp 0 0 0.0.0.0:2525 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 0.0.0.0:6081 0.0.0.0:* LISTEN 11883/varnishd
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 11882/varnishd
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1950/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 2117/clamd
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 :::465 :::* LISTEN 2061/exim
tcp 0 0 :::22 :::* LISTEN 772/sshd
tcp 0 0 :::25 :::* LISTEN 2061/exim
tcp 0 0 ::1:953 :::* LISTEN 2020/named
tcp 0 0 :::2525 :::* LISTEN 2061/exim
tcp 0 0 :::6081 :::* LISTEN 11883/varnishd
tcp 0 0 :::587 :::* LISTEN 2061/exim
udp 0 0 123.123.123.123:53 0.0.0.0:* 2020/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 2020/named
[root@server1 ~]# ^C
123.123.123.123 = ip server
What am I doing wrong? thank you very much to all, not how to solve it!
/ etc / varnish / default.vcl---------------------------------------------------------
( ... )
backend default {
. host = "127.0.0.1 " ;
. port = " 8080" ;
}
( ... )
/ home / admin / conf / web / nginx.conf-------------------------------------------------------------------
server {
listen 123.123.123.123:8080 , < --- IP VPS
server_name domain.com www.domain.com ;
error_log / var / log / httpd / domains / domain.com.error.log mistake ;
location / {
PROXY_PASS http://123.123.123.123:8080 ; ---- << IP VPS
location ~ * ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|exe|pdf|doc|xls|ppt|txt|odt|ods|odp|odf|tar|bmp|rtf|js|mp3|avi|mpeg|flv|html|htm)$ {
root / home / admin / web / estanochefollamos.com / public_html ;
access_log / var / log / httpd / domains / domain.com.log combined ;
access_log / var / log / httpd / domains / domain.com.bytes bytes;
expires max ;
try_files $ uri @ fallback ;
}
}
location / error / {
alias / home / admin / web / domain.com / document_errors / ;
}
location @ fallback {
PROXY_PASS http://123.123.123.123:8080 ;
}
. location ~ / \ ht {return 404; }
. location ~ / \ svn / {return 404; }
. location ~ / \ git / {return 404; }
. location ~ / \ hg / {return 404; }
. location ~ / \ bzr / {return 404; }
include / home / admin / conf / web / nginx.domain.com.conf * ;
}
/ etc / sysconfig / varnish----------------------------------------------------------------
( ... )
DAEMON_OPTS = " -a: 80 \
-T localhost: 6082 \
-f / etc / varnish / default.vcl \
- or varnish - g varnish \
- S / etc / varnish / secret \
- s file , / var / lib / varnish / varnish_storage.bin , 1G "
( ... )
netsat - ntlup----------------------------------------------------------
[root@server1 ~]# netstat -ntlup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 2133/spamd.pid
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 123.123.123.123:8080 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 123.123.123.123:80 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 4239/nginx
tcp 0 0 127.0.0.1:8084 0.0.0.0:* LISTEN 11854/nginx
tcp 0 0 123.123.123.123:53 0.0.0.0:* LISTEN 2020/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2020/named
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1577/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 772/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2020/named
tcp 0 0 0.0.0.0:2525 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 0.0.0.0:6081 0.0.0.0:* LISTEN 11883/varnishd
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 11882/varnishd
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1950/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 2061/exim
tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 2117/clamd
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 2085/dovecot
tcp 0 0 :::465 :::* LISTEN 2061/exim
tcp 0 0 :::22 :::* LISTEN 772/sshd
tcp 0 0 :::25 :::* LISTEN 2061/exim
tcp 0 0 ::1:953 :::* LISTEN 2020/named
tcp 0 0 :::2525 :::* LISTEN 2061/exim
tcp 0 0 :::6081 :::* LISTEN 11883/varnishd
tcp 0 0 :::587 :::* LISTEN 2061/exim
udp 0 0 123.123.123.123:53 0.0.0.0:* 2020/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 2020/named
[root@server1 ~]# ^C
123.123.123.123 = ip server
What am I doing wrong? thank you very much to all, not how to solve it!
Re: VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
chain should look like:
1 varnish - :80
2 nginx - any port
3 httpd - :8080
or
1 nginx - :80
2 varnish - any port
3 httpd - :8080
yours config
loopback
and apache is down
1 varnish - :80
2 nginx - any port
3 httpd - :8080
or
1 nginx - :80
2 varnish - any port
3 httpd - :8080
yours config
loopback
Code: Select all
/ home / admin / conf / web / nginx.conf
listen 123.123.123.123:8080
location @ fallback {
PROXY_PASS http://123.123.123.123:8080 ;
}
Re: VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
Hi, i am useing similar setup but i cant make this to work.
I have varnish to listen on 80 and backend is 82,
apache to listen to 82, (in userdir made change)
nginx down
both start fine and configs looks ok but i get varnish 503 error.
I also tried similar thing with nginx instead of apache, but with same result.
Is there any definitive step by step actions to do this?
Thanks
I have varnish to listen on 80 and backend is 82,
apache to listen to 82, (in userdir made change)
nginx down
both start fine and configs looks ok but i get varnish 503 error.
I also tried similar thing with nginx instead of apache, but with same result.
Is there any definitive step by step actions to do this?
Thanks
Re: VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
I also had too many problems getting varnish to work with vestacp. I recommend you do not install it as it broke one of my vestacp installations :(
Re: VestaCP + Varnish + Nginx = Errorx nginx 400/500/502
It is a test VPS so i can rebuild it at any time. It is ok to play around...