Skip to content

Instantly share code, notes, and snippets.

@EmilienMottet
Created August 6, 2018 15:36
Show Gist options
  • Save EmilienMottet/d06d063496515e2bc508bb085f8a81ee to your computer and use it in GitHub Desktop.
Save EmilienMottet/d06d063496515e2bc508bb085f8a81ee to your computer and use it in GitHub Desktop.
# Make sure mod_ssl, mod_rewrite, mod_headers, mod_proxy,
# mod_proxy_http and mod_proxy_balancer are enabled
<VirtualHost *:80>
ServerName huginn.example.org
RedirectPermanent / https://huginn.example.org/
</VirtualHost>
<VirtualHost *:443>
ServerName huginn.example.org
DocumentRoot /path/to/huginn/public
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://upstream%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://upstream>
BalancerMember http://127.0.0.1:3000
</Proxy>
ProxyRequests Off
ProxyVia On
ProxyPreserveHost On
RequestHeader set X_FORWARDED_PROTO https
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
<Directory /path/to/huginn/public>
Allow from all
AllowOverride all
Options -MultiViews
</Directory>
SSLEngine On
SSLCertificateFile /path/to/cert
SSLCertificateKeyFile /path/to/private_key
# maybe not needed, need for example for startssl to point to a local
# copy of http://www.startssl.com/certs/sub.class1.server.ca.pem
SSLCertificateChainFile /path/to/chain_file
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment