Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Replace yourdomain.tld with your domain
- // Replace port with the port
- // Only http
- <VirtualHost *:80>
- ServerName yourdomain.tld
- DocumentRoot /home/web
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- # If you do not use a proxy
- <Directory /home/web>
- AllowOverride all
- Require all granted
- </Directory>
- # If you use a proxy
- ProxyPreserveHost On
- ProxyPass / http://127.0.0.1:port/
- ProxyPassReverse / http://127.0.0.1:port/
- # If the application use websockets
- RewriteCond %{HTTP:Upgrade} =websocket
- RewriteRule /(.*) ws://localhost:port/$1 [P,L]
- RewriteCond %{HTTP:Upgrade} !=websocket
- RewriteRule /(.*) http://localhost:port/$1 [P,L]
- </VirtualHost>
- // With SSL (https)
- <VirtualHost *:80>
- ServerName yourdomain.tld
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- RewriteEngine on
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
- </VirtualHost>
- <VirtualHost *:443>
- ServerName yourdomain.tld
- DocumentRoot /home/web
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- SSLEngine On
- SSLCertificateFile /etc/letsencrypt/live/yourdomain.tld/cert.pem
- SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.tld/privkey.pem
- SSLCertificateChainFile /etc/letsencrypt/live/yourdomain.tld/fullchain.pem
- # If you do not use a proxy
- <Directory /home/web>
- AllowOverride all
- Require all granted
- </Directory>
- # If you use a proxy
- ProxyPreserveHost On
- ProxyPass / http://127.0.0.1:port/
- ProxyPassReverse / http://127.0.0.1:port/
- # If the application use websockets
- RewriteCond %{HTTP:Upgrade} =websocket
- RewriteRule /(.*) ws://localhost:port/$1 [P,L]
- RewriteCond %{HTTP:Upgrade} !=websocket
- RewriteRule /(.*) http://localhost:port/$1 [P,L]
- </VirtualHost>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement