system-config/modules/gerrit/templates/gerrit.vhost.erb
James E. Blair afa87385cc Add robots.txt to gerrit.
And slow down bing (msnbot).

Change-Id: Id8361047abc2cfb52260b3d0ef01275ec3a923f5
Reviewed-on: https://review.openstack.org/32435
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Elizabeth Krumbach Joseph <lyz@princessleia.com>
Reviewed-by: Anita Kuno <anita.kuno@enovance.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2013-06-10 20:21:16 +00:00

87 lines
2.6 KiB
Plaintext

<VirtualHost <%= scope.lookupvar("gerrit::vhost_name") %>:80>
ServerAdmin <%= scope.lookupvar("gerrit::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/gerrit-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/gerrit-access.log combined
Redirect / https://<%= scope.lookupvar("gerrit::vhost_name") %>/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost <%= scope.lookupvar("gerrit::vhost_name") %>:443>
ServerName <%= scope.lookupvar("gerrit::vhost_name") %>
ServerAdmin <%= scope.lookupvar("gerrit::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/gerrit-ssl-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/gerrit-ssl-access.log combined
SSLEngine on
SSLCertificateFile <%= scope.lookupvar("gerrit::ssl_cert_file") %>
SSLCertificateKeyFile <%= scope.lookupvar("gerrit::ssl_key_file") %>
<% if scope.lookupvar("gerrit::ssl_chain_file") != "" %>
SSLCertificateChainFile <%= scope.lookupvar("gerrit::ssl_chain_file") %>
<% end %>
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
RewriteEngine on
RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("gerrit::vhost_name") %>
RewriteRule ^.*$ <%= scope.lookupvar("gerrit::canonicalweburl") %>
<% if scope.lookupvar("gerrit::replicate_local") -%>
RewriteCond %{REQUEST_URI} !^/p/
<% end -%>
<% if scope.lookupvar("gerrit::contactstore") == true -%>
RewriteCond %{REQUEST_URI} !^/fakestore$
<% end -%>
<% if scope.lookupvar("gerrit::robots_txt_source") != "" -%>
RewriteCond %{REQUEST_URI} !^/robots.txt$
<% end -%>
RewriteRule ^/(.*)$ http://localhost:8081/$1 [P]
ProxyPassReverse / http://localhost:8081/
<% if scope.lookupvar("gerrit::robots_txt_source") != "" -%>
Alias /robots.txt /home/gerrit2/review_site/static/robots.txt
<% end -%>
<% if scope.lookupvar("gerrit::replicate_local") -%>
SetEnv GIT_PROJECT_ROOT /var/lib/git/
SetEnv GIT_HTTP_EXPORT_ALL
AliasMatch ^/p/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
AliasMatch ^/p/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
ScriptAlias /p/ /usr/lib/git-core/git-http-backend/
<% end -%>
<% if scope.lookupvar("gerrit::contactstore") == true -%>
ScriptAlias /fakestore /home/gerrit2/review_site/lib/fakestore.cgi
<% end -%>
<Directory /home/gerrit2/review_site/git/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
</IfModule>