Skip to content

Instantly share code, notes, and snippets.

@Max95Cohen
Last active January 20, 2023 03:36
Show Gist options
  • Save Max95Cohen/5e878b5724031b054cbf20790101999a to your computer and use it in GitHub Desktop.
Save Max95Cohen/5e878b5724031b054cbf20790101999a to your computer and use it in GitHub Desktop.
example.conf apache2 virtual host config
<VirtualHost *:80>
CustomLog /path/access.log combined
DirectoryIndex index.php index.html
DocumentRoot /path
ErrorLog /path/error.log
ServerAlias www.example.com
ServerName example.com
<Directory /path>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
RewriteCond %{REQUEST_URI} ^/websocket [NC]
RewriteRule /(.*) ws://localhost:2083/$1 [P,L]
ProxyPass / http://localhost:2083
ProxyPassReverse / http://localhost:2083
</IfModule>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
CustomLog /path/access.log combined
DocumentRoot /path
ErrorLog /path/error.log
ServerAlias www.example.com
ServerName example.com
<Directory /path>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/certificate.cert
SSLCertificateKeyFile /etc/ssl/private/private.key
SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/websocket [NC]
RewriteRule /(.*) ws://localhost:2083/$1 [P,L]
ProxyPass / http://localhost:2083
ProxyPassReverse / http://localhost:2083
</VirtualHost>
</IfModule>
<VirtualHost *:80>
CustomLog /var/www/html/f/access.log common
ErrorLog /var/www/html/f/error.log
ServerName f.3d-market.kz
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://192.168.1.9/
ProxyPassReverse / http://192.168.1.9/
RewriteEngine on
RewriteCond %{SERVER_NAME} =f.3d-market.kz
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
ServerName api.qazaqmura.local
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment