0
votes

after installing varnish all domains on my server using HTTP redirect to -http://my_domain.com/cgi-sys/defaultwebpage.cgi. I went to cPanel Technical Support and they reply to me with this answer.. basically, Varnish isn't configured properly.

We have been able to test your server's configuration and found that Varnish hasn't been configured correctly and is causing the websites you mentioned to load to a "defaultwebpage.cgi". We have been able to confirm that Apache is loading correctly and upon testing, we can see that it's listening on Port 8080:

[19:41:57 server1 root@94376622 /home/prowp/public_html/my_domain.com]cPs# netstat -l -n -p | grep httpd tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 11666/httpd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 11666/httpd unix 2 [ ACC ] STREAM LISTENING 101366516 11667/httpd /etc/apache2/run/cgid_sock.21361

if you request the websites on the apache http port locally on the server, we can see that it's loading correctly

[19:42:53 server1 root@94376622 /home/prowp/public_html/my_domain.com]cPs# curl -I http://my_domain.com:8080 HTTP/1.1 301 Moved Permanently Date: Sun, 24 Oct 2021 16:43:29 GMT Server: Apache X-Powered-By: PHP/7.4.24 X-Redirect-By: WordPress Upgrade: h2,h2c Connection: Upgrade Location: https://www.my_domain.com/ Vary: Accept-Encoding Content-Type: text/html; charset=UTF-8 But upon testing it without directing it to Apache for it to use Varnish it then loads the "defaultwebpage.cgi":

[19:43:48 server1 root@94376622 /home/prowp/public_html/my_domain.com]cPs# curl http://my_domain.com

> [19:46:48 server1 root@94376622 /home/prowp/public_html/my_domain.com]cPs# curl http://my_domain.com [19:56:33 server1 root@94376622 /home/prowp/public_html/my_domain.com]cPs#

Maybe someone can help? Thank you

1

1 Answers

0
votes

after digging to solve the issue I across this article Configure Varnish and your web server

the advice in section 5:

If Varnish and Apache are running on the same host, we recommend you use an IP address or hostname and not localhost. but in my /etc/varnish/default.vcl i added wrong ip address...

backend default {
.host = "127.0.0.1";
.port = "80";

}

so i change it to my ip address

backend default {
.host = "my_ip_address";
.port = "80";

}

as varnish and apache are on the same host. and now no more cgi-sys/defaultwebpage.cgi. file in front of my domain when using HTTP.