Project

General

Profile

Bug #5714 » vhost.conf

Jean-Michel Mazzocco, 14.05.2024 16:12

 
NameVirtualHost *:80
NameVirtualHost *:8090
NameVirtualHost *:443
NameVirtualHost *:8443

# Default virtual host. Must be defined first
<VirtualHost *:80>
ServerName xxxxxxx.com
Redirect / https://xxxxxxxxx.com/
</VirtualHost>

<VirtualHost *:80>
ServerName localhost
ServerAlias 127.0.0.1
# Added 10/02/2015
<Location /server-status>
SetHandler server-status
</Location>
# End Add
</VirtualHost>


<VirtualHost *:8090>
ServerName xxxxxxxxx.com
DocumentRoot /var/www/html/

ErrorLog /var/log/httpd/svn_error_log
CustomLog /var/log/httpd/svn_access_log combined
Include /product/rhodecode/.rccontrol/enterprise-1/mod_dav_svn.conf
</VirtualHost>

# This is the first SSL vhost defined and will catch all requests
<VirtualHost *:8443>
ServerName xxxxxxxxxxxxx.com
DocumentRoot /var/www/html/
SSLEngine on

SSLCertificateFile /etc/httpd/keys/xxxxxxxxxxxxx.crt
SSLCertificateKeyFile /etc/httpd/keys/xxxxxxxxxxx.key
ErrorLog /var/log/httpd/svn_s_error_log
CustomLog /var/log/httpd/svn_s_access_log combined
Include /product/rhodecode/.rccontrol/enterprise-1/mod_dav_svn.conf
</VirtualHost>

# This is the first SSL vhost defined and will catch all requests
# # with unknown names, like https://10.0.0.0/ ...
<VirtualHost *:443>
ServerName xxxxxxxxxxxxxxxxxx.com
SSLEngine on

SSLCertificateFile /etc/httpd/keys/xxxxxxxxxxx.crt
SSLCertificateKeyFile /etc/httpd/keys/xxxxxxxxxxx.key

Redirect / https://xxxxxxxxxxx.com/
</VirtualHost>


<VirtualHost *:443>

SSLEngine on

# Add line for increase the max header size - jmmazzoc
# LimitRequestFieldSize 200000

SSLCertificateFile /etc/httpd/keys/xxxxxxxxxxx.crt
SSLCertificateKeyFile /etc/httpd/keys/xxxxxxxxxxx.key

ServerName xxxxxxxxxxx.com
DocumentRoot /var/www/html/

## Skip ProxyPass the _static to backend server
ProxyPass /_static !
ProxyPass /hg/_static !

## serve static files by Apache, recommended for performance
Alias /_static/rhodecode /product/rhodecode/.rccontrol/enterprise-1/static
Alias /hg/_static/rhodecode /product/rhodecode/.rccontrol/enterprise-1/static

## Allow Apache to access the static files in this directory
<Directory /product/rhodecode/.rccontrol/enterprise-1/static/>
AllowOverride none
Require all granted
</Directory>


##########################
# SVN repositoty (bserant)
##########################
#Include /product/rhodecode/.rccontrol/enterprise-1/mod_dav_svn.conf

ProxyPreserveHost On
# Default global Timeout is already 86400 in conf/httpd.conf
#ProxyTimeout 86400
# To avoid "proxy: error reading status line from remote server"
SetEnv proxy-initial-not-pooled 1

<Location /balancer-manager>
SetHandler balancer-manager
</Location>

# Added 10/02/2015
# modified 18/06/2019
<Location /server-status>
SetHandler server-status
# Order Deny,Allow
Order Allow,Deny
# Deny from all
# Allow from 10.10.148.185
Allow from 10.60.240.142
</Location>
# End Add

# Start of new config
<Proxy balancer://redmine2_app>
BalancerMember http://localhost:4001 max=1
BalancerMember http://localhost:4002 max=1
ProxySet maxattempts=3 lbmethod=bybusyness
Allow from all
</Proxy>

RewriteEngine On
# The next rule is like 'Alias /redmine /product/redmine/redmine/public' except it is executed _right now_
RewriteRule ^/redmine2(.*) /product/redmine2/current/redmine/public$1
# If URL looks like /redmine[...] _and_ does not map to a file, forward it to Redmine
RewriteCond %{REQUEST_URI} ^/redmine2(.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . balancer://redmine2_app/redmine2%1 [P,L]
# Otherwise Apache will serve the file normally.
# end of new config

RequestHeader set X_FORWARDED_PROTO 'https'


## Redmine3 ##

# Start of new config
<Proxy balancer://redmine3_app>
BalancerMember http://localhost:6001 max=1
BalancerMember http://localhost:6002 max=1
ProxySet maxattempts=3 lbmethod=bybusyness
Allow from all
</Proxy>

RewriteEngine On
# The next rule is like 'Alias /redmine /product/redmine/redmine/public' except it is executed _right now_
RewriteRule ^/redmine3(.*) /product/redmine3/current/redmine/public$1
# If URL looks like /redmine[...] _and_ does not map to a file, forward it to Redmine
RewriteCond %{REQUEST_URI} ^/redmine3(.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . balancer://redmine3_app/redmine3%1 [P,L]
# Otherwise Apache will serve the file normally.
# end of new config

RequestHeader set X_FORWARDED_PROTO 'https'

## Redmine ##

# start of old config
# <Proxy balancer://redmine_app>
# BalancerMember http://localhost:3001 max=1
# BalancerMember http://localhost:3002 max=1
# ProxySet maxattempts=3 lbmethod=bybusyness
# Allow from all
# </Proxy>
#
# Alias /redmine /product/redmine/redmine/public
#
# # if file doesn't exists, it's a command passed to Redmine
# RewriteEngine On
# RewriteCond %{LA-U:REQUEST_FILENAME} !-f
# RewriteRule ^/redmine(.*) balancer://redmine_app/redmine$1 [P,L]
# old of old config

# Start of new config
<Proxy balancer://redmine_app>
BalancerMember http://localhost:3001 max=1
BalancerMember http://localhost:3002 max=1
ProxySet maxattempts=3 lbmethod=bybusyness
Allow from all
</Proxy>

RewriteEngine On
# The next rule is like 'Alias /redmine /product/redmine/redmine/public' except it is executed _right now_
RewriteRule ^/redmine(.*) /product/redmine/current/redmine/public$1
# If URL looks like /redmine[...] _and_ does not map to a file, forward it to Redmine
RewriteCond %{REQUEST_URI} ^/redmine(.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . balancer://redmine_app/redmine%1 [P,L]
# Otherwise Apache will serve the file normally.
# End of new config

RequestHeader set X_FORWARDED_PROTO 'https'

# Apply "good practice" (as per Yahoo and Google recommendations) on Redmine's static assets. max-age in seconds (30 days)
<LocationMatch ^/redmine/(custom/|favicon\.ico|help/|images/|javascripts/|plugin_assets/|stylesheets/|themes/)>
Header unset ETag
Header set Cache-Control "max-age=2592000, public"
</LocationMatch>

## **************** RHODECODE ****************** ##

<Proxy balancer://rhodecode_app>
BalancerMember http://localhost:5000 max=360 retry=0
ProxySet timeout=15 maxattempts=3
Allow from all
</Proxy>

# if file doesn't exists, it's a command passed to Rhodecode
RewriteEngine On

RewriteCond %{LA-U:REQUEST_FILENAME} !-f
#RewriteRule /hg/_static/rhodecode(.*) /product/rhodecode/.rccontrol/enterprise-1/static$1 [L]
RewriteRule ^/hg(.*) balancer://rhodecode_app/hg$1 [P,L]

# indicate to paster to generate https URL
RequestHeader set X-Url-Scheme https

## LOGS ##
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined
</VirtualHost>

<VirtualHost *:8090>
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/svn_error.log
CustomLog /var/log/httpd/svn_access.log combined
</VirtualHost>
(1-1/2)