This documentation is guide to setup Apache as web server to serve https
, and offload ssl traffic, and reverse proxy request to backend CodiMD server.
# Redirect http to https
<VirtualHost *:80>
ServerName codimd.example.com
Redirect permanent / https://md.example.com/
</VirtualHost>
# https
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName codimd.example.com
# SSL Config
SSLEngine on
SSLCertificateKeyFile /usr/local/apache2/certs/codimd.example.com/cert-key.pem
SSLCertificateFile /usr/local/apache2/certs/codimd.example.com/cert.pem
SSLProtocol all -SSLv2 -SSLv3 -TLSv1
SSLHonorCipherOrder on
SSLCipherSuite ALL:+HIGH:!ADH:!EXP:!SSLv2:!SSLv3:!MEDIUM:!LOW:!NULL:!aNULL
SSLHonorCipherOrder on
# Proxy websocket traffic
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule (.*) ws://127.0.0.1:3000/$1 [P,L]
# Proxy normal http traffic
ProxyPass / http://127.0.0.1:3000/
</VirtualHost>
</IfModule>
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up