Skip to content

Instantly share code, notes, and snippets.

@stain
Created May 11, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stain/1a258fc03fcb2ecd4b80f04c65c2167d to your computer and use it in GitHub Desktop.
Save stain/1a258fc03fcb2ecd4b80f04c65c2167d to your computer and use it in GitHub Desktop.
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
backend default {
.host = "127.0.0.1";
.port = "8080";
}
backend owl {
.host = "192.168.1.123";
.port = "80";
}
backend docker {
.host = "192.168.1.28";
.port = "80";
}
backend explorer {
.host = "192.168.1.28";
.port = "3000";
}
backend elasticsearch {
.host = "192.168.1.28";
.port = "9200";
}
backend jira {
.host = "192.168.1.28";
.port = "8081";
}
sub vcl_recv {
if (req.http.host ~ "^explorer.s11.no$") {
set req.backend = explorer;
set req.grace=7d;
return(lookup);
} elsif (req.http.host ~ "^ops.s11.no$") {
set req.backend = docker;
set req.grace=7d;
return(pass);
} elsif (req.http.host ~ "^cwl.s11.no$") {
set req.backend = docker;
set req.grace=7d;
return(pass);
} elsif (req.http.host ~ "^jira.s11.no$") {
set req.backend = jira;
set req.grace=7d;
return(pass);
} elsif (req.http.host ~ "^search.s11.no$") {
set req.backend = elasticsearch;
set req.grace=7d;
return(pass);
} elsif (req.http.host ~ "^owl.s11.no$") {
set req.backend = owl;
set req.grace=7d;
return(pass);
} elsif (req.http.host ~ "^(www.)?s11.no$") {
set req.backend = default;
set req.http.host = "s11.no";
set req.grace=7d;
if (req.url ~ "^/scrap/" ) {
return(pass);
}
return(lookup);
} elsif (req.http.host ~ "^(www.)?soiland-reyes.com$") {
set req.backend = default;
set req.http.host = "soiland-reyes.com";
set req.grace=7d;
if (req.request == "GET" && req.http.cookie) {
unset req.http.Cookie;
return(lookup);
}
return(lookup);
} else {
set req.backend = default;
}
}
<VirtualHost *:8080>
ServerAdmin webmaster@s11.no
ServerName s11.no
ServerAlias www.s11.no
ServerAlias xn--11-slc.xn--e1a4c
ServerAlias www.xn--11-slc.xn--e1a4c
DocumentRoot /srv/www/vhosts/s11.no
ErrorLog /var/log/apache2/s11.no-error_log
CustomLog /var/log/apache2/s11.no-access_log vhost_combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
Include /etc/apache2/conf.d/*.conf
<Directory "/srv/www/vhosts/s11.no">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ProxyPass /cam http://[2002:545c:301a:1:8c2a:266a:838f:4f8]:8080/
#ProxyPass /owlview http://[2002:545c:301a:0:8808:3aff:fe68:fb09]/
#ProxyPassReverse /owlview http://[2002:545c:301a:0:8808:3aff:fe68:fb09]/
ProxyPass /owlview http://192.168.1.123/
ProxyPassReverse /owlview http://192.168.1.123/
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin webmaster@s11.no
ServerName soiland-reyes.com
ServerAlias www.soiland-reyes.com
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot /srv/www/vhosts/soiland-reyes.com
# if not specified, the global error log is used
ErrorLog /var/log/apache2/soiland-reyes.com-error_log
CustomLog /var/log/apache2/soiland-reyes.com-access_log vhost_combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
# Optionally, include *.conf files from /etc/apache2/conf.d/
#
# For example, to allow execution of PHP scripts:
#
# Include /etc/apache2/conf.d/mod_php4.conf
#
# or, to include all configuration snippets added by packages:
Include /etc/apache2/conf.d/*.conf
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/srv/www/vhosts/soiland-reyes.com/cgi-bin/"
# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have one, and where ScriptAlias points to.
#
<Directory "/srv/www/vhosts/soiland-reyes.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/srv/www/vhosts/soiland-reyes.com">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment