60 lines
1.8 KiB
Text
60 lines
1.8 KiB
Text
# Apache vhost example for GSP Panel
|
|
# Copy to: /etc/apache2/sites-available/panel.example.com.conf
|
|
#
|
|
# Enable modules once:
|
|
# sudo a2enmod ssl rewrite headers
|
|
#
|
|
# Enable site:
|
|
# sudo a2ensite panel.example.com.conf
|
|
# sudo apache2ctl configtest
|
|
# sudo systemctl reload apache2
|
|
#
|
|
# Issue certificate (Apache plugin):
|
|
# sudo certbot --apache -d panel.example.com -d www.panel.example.com
|
|
#
|
|
# Alternative webroot issuance:
|
|
# sudo certbot certonly --webroot -w /var/www/gsp/Panel \
|
|
# -d panel.example.com -d www.panel.example.com
|
|
#
|
|
# Renewal test:
|
|
# sudo certbot renew --dry-run
|
|
|
|
<VirtualHost *:80>
|
|
ServerName panel.example.com
|
|
ServerAlias www.panel.example.com
|
|
DocumentRoot /var/www/html/Panel
|
|
|
|
<Directory /var/www/html/Panel>
|
|
Options FollowSymLinks
|
|
AllowOverride All
|
|
Require all granted
|
|
</Directory>
|
|
|
|
RewriteEngine On
|
|
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
|
|
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
|
|
ErrorLog ${APACHE_LOG_DIR}/panel_example_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/panel_example_access.log combined
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:443>
|
|
ServerName panel.example.com
|
|
ServerAlias www.panel.example.com
|
|
DocumentRoot /var/www/html/Panel
|
|
|
|
<Directory /var/www/html/Panel>
|
|
Options FollowSymLinks
|
|
AllowOverride All
|
|
Require all granted
|
|
</Directory>
|
|
|
|
SSLEngine on
|
|
SSLCertificateFile /etc/letsencrypt/live/panel.example.com/fullchain.pem
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/panel.example.com/privkey.pem
|
|
|
|
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
|
|
ErrorLog ${APACHE_LOG_DIR}/panel_example_ssl_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/panel_example_ssl_access.log combined
|
|
</VirtualHost>
|