Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Load Balancing configuration

sven15 edited this page Feb 27, 2016 · 26 revisions

Proxy / Load Balancer

/etc/apache2/sites-enabled/virtualhost.conf

<VirtualHost *:80>
    ServerName cms-test.integreat-app.de
    DocumentRoot /var/www/redirect

    ProxyPass /wordpress_test/ http://server1.integreat-app.de/wordpress_test/
    ProxyPassReverse /wordpress_test/ http://server1.integreat-app.de/wordpress_test/

</VirtualHost>

<Virtualhost *:443>
    ServerName cms-test.integreat-app.de
    DocumentRoot /var/www/redirect

    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/cms-test.integreat-app.de/cert.pem
    SSLCertificateChainFile /etc/letsencrypt/live/cms-test.integreat-app.de/chain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cms-test.integreat-app.de/privkey.pem

    ProxyPass /wordpress_test/ http://cms-test.integreat-app.de/wordpress_test/
    ProxyPassReverse /wordpress_test/ http://cms-test.integreat-app.de/wordpress_test/

</VirtualHost>

/etc/apache2/sites-enabled/rewrite-rules.conf

<Directory /var/www>
    RewriteEngine On
    RewriteBase /wordpress_test/
    RewriteRule ^index\.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    <Files database.sql>
            Order Allow,Deny
            Deny from all
    </Files>
    <Files wp-config.php>
            Order Allow,Deny
            Deny from all
    </Files>
    <Files config.ini>
            Order Allow,Deny
            Deny from all
    </Files>

`

PHP Server

/etc/apache/sites-enabled/virtualhost.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/
    ServerName server1.integreat-app.de
    <Directory /var/www/html/wordpress_test>
            AllowOverride All
            Options -Indexes
    </Directory>

    RequestHeader edit Host server1.integreat-app.de cms-test.integreat-app.de

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>`

Clone this wiki locally