luceos I was talking in skype with a friend tonight, he could help me today maybe, so I didn't do nothing and keep waiting. I manage my own servers long time ago (forced to learn), the first leasson don't worry if you need wait to broke the servers.
My issue: my server CENTOS7 with varnish+apache+mysql+php7 is configurated just for one domain. Like I told... I really want to create a forum with FLARUM.
Varnish4 is configurated to listen the port: 80
Apache is configurated to listen the port: 8080
I go to replace my current routes and real domain in the configuration files.
Thats a sample of my Apache .conf file located at /etc/httpd/conf.d/domain1.conf, I will need the same file but with domain2.conf.
<VirtualHost *:8080>
ServerName www.domain1.es
ServerAlias domain1.es
DocumentRoot /var/www/domain1.es/httpdocs
ErrorLog /var/log/httpd/domain1.es-error.log
CustomLog /var/log/httpd/domain1.es-acces.log combined
<Directory /var/www/domain1.es/httpdocs>
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
I have also ssl.conf file to manage the certificate SSL but I think that is right, more than 200 and the most probably is not important. I told it because usually the people add these config at domain.conf file with the certs and key routes. The SSL listen the port 443 as the most people know ?
Now, as I was reading, to allow multiple hosts with varnish I need to configure the .vcl file located at /etc/varnish/default.vcl, at this file currently I got the basic parameters, like this:
#################################################
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
}
sub vcl_backend_response {
}
sub vcl_deliver {
}
#################################################
I was looking different guides, also the official wiki (http://varnish-cache.org/trac/wiki/VCLExampleRedirectInVCL) to manage different vhosts with varnish, I understand that is required to add a new backend and vcl_recv rules. So my the .vcl file located at /etc/varnish/default.vcl need looks like -care I know that is wrong- this:
############
backend default {
.host = "127.0.0.1";
.port = "8080";
}
backend domain1 {
.host = "127.0.0.1";
.port = "8080";
}
backend domain2 {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
############ PLEASE NOTE THAT I SAW DIFFERENT SINTAX FOR THE SAME PROBLEM AT THESE IF:
if (req.http.host == "domain1.es") {
set req.http.host = "domain1";
set req.backend = domain1;
return (lookup);
}
############ PLEASE NOTE THAT I SAW DIFFERENT SINTAX FOR THE SAME PROBLEM AT THESE IF:
if (req.http.host ~ "(www.)?domain2.es$") {
set req.backend = domain2;
return (lookup);
}
}
############
As I was looking varnish can balance the load between servers there -at these lines-, manage IP of different domains at same server and much more. But I dont know the right sintax, I saw more than these 2 sintax options and the people dind't notify the version (varnish3,4,5...) also I dont know if i'm right or not doing just these modifications.
Finally tonight I went to the bed to watch star trek ?
Good morning!