Skip to content

Instantly share code, notes, and snippets.

@Shillos
Forked from ItsOnlyBinary/kiwiirc.apache
Created April 28, 2020 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shillos/a90f11a5ab262d64a304765626899062 to your computer and use it in GitHub Desktop.
Save Shillos/a90f11a5ab262d64a304765626899062 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ServerName kiwiirc.example.com
ServerAdmin webmaster@example.com
# Kiwi IRC client files are located here
DocumentRoot /usr/share/kiwiirc
DirectoryIndex index.html
# Reverse proxy websocket connections
# requires: a2enmod rewrite proxy proxy_wstunnel
RewriteEngine On
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteRule .* ws://localhost:7778%{REQUEST_URI} [P,QSA,L]
# Reverse proxy http connections
# requires: a2enmod proxy proxy_http
ProxyVia On
ProxyRequests Off
ProxyPass /webirc/ http://localhost:7778/webirc/
ProxyPassReverse /webirc/ http://localhost:7778/webirc/
ProxyPreserveHost on
# send all connections to https (can remove above rewrite/proxy rules)
# RewriteCond %{SERVER_NAME} =kiwiirc.example.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName kiwiirc.example.com
ServerAdmin webmaster@example.com
# Kiwi IRC client files are located here
DocumentRoot /usr/share/kiwiirc
DirectoryIndex index.html
# SSL config
# requires: a2enmod ssl
SSLEngine on
# Reverse proxy websocket connections
# requires: a2enmod rewrite proxy proxy_wstunnel
RewriteEngine On
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteRule .* ws://localhost:7778%{REQUEST_URI} [P,QSA,L]
# Reverse proxy http connections
# requires: a2enmod proxy proxy_http
ProxyVia On
ProxyRequests Off
ProxyPass /webirc/ http://localhost:7778/webirc/
ProxyPassReverse /webirc/ http://localhost:7778/webirc/
ProxyPreserveHost on
# Letsencrypt certificates
SSLCertificateFile /etc/letsencrypt/live/kiwiirc.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kiwiirc.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment