92 lines
2.9 KiB
Plaintext
92 lines
2.9 KiB
Plaintext
|
|
# ==================== APEX (SITO) ====================
|
|||
|
|
# HTTP -> HTTPS
|
|||
|
|
<VirtualHost *:80>
|
|||
|
|
ServerName ${MIODOMINIO_COMPLETO}
|
|||
|
|
|
|||
|
|
RewriteEngine On
|
|||
|
|
RewriteRule ^ https://${MIODOMINIO_COMPLETO}%{REQUEST_URI} [R=301,L]
|
|||
|
|
|
|||
|
|
ErrorLog /var/log/apache2/${MIODOMINIO_COMPLETO}-error.log
|
|||
|
|
CustomLog /var/log/apache2/${MIODOMINIO_COMPLETO}-access.log combined
|
|||
|
|
</VirtualHost>
|
|||
|
|
|
|||
|
|
# HTTPS (servizio sito - NO proxy qui)
|
|||
|
|
<VirtualHost *:443>
|
|||
|
|
ServerName ${MIODOMINIO_COMPLETO}
|
|||
|
|
|
|||
|
|
DocumentRoot /var/www/${MIODOMINIO_COMPLETO}
|
|||
|
|
|
|||
|
|
SSLEngine on
|
|||
|
|
SSLCertificateFile /etc/letsencrypt/live/${MIODOMINIO}/fullchain.pem
|
|||
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/${MIODOMINIO}/privkey.pem
|
|||
|
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
|||
|
|
Protocols h2 http/1.1
|
|||
|
|
|
|||
|
|
<Directory "/var/www/${MIODOMINIO_COMPLETO}">
|
|||
|
|
Options Indexes FollowSymLinks
|
|||
|
|
AllowOverride All
|
|||
|
|
Require all granted
|
|||
|
|
</Directory>
|
|||
|
|
|
|||
|
|
DirectoryIndex index.html
|
|||
|
|
|
|||
|
|
# (Opzionale per SPA Quasar/Vue)
|
|||
|
|
# RewriteEngine On
|
|||
|
|
# RewriteCond %{REQUEST_FILENAME} !-f
|
|||
|
|
# RewriteCond %{REQUEST_FILENAME} !-d
|
|||
|
|
# RewriteRule ^ /index.html [L]
|
|||
|
|
|
|||
|
|
ErrorLog /var/log/apache2/${MIODOMINIO_COMPLETO}-error.log
|
|||
|
|
CustomLog /var/log/apache2/${MIODOMINIO_COMPLETO}-access.log combined
|
|||
|
|
</VirtualHost>
|
|||
|
|
|
|||
|
|
|
|||
|
|
# ==================== API ====================
|
|||
|
|
# HTTP -> HTTPS
|
|||
|
|
<VirtualHost *:80>
|
|||
|
|
ServerName ${MIOURL_API}
|
|||
|
|
|
|||
|
|
RewriteEngine On
|
|||
|
|
RewriteRule ^ https://${MIOURL_API}%{REQUEST_URI} [R=301,L]
|
|||
|
|
|
|||
|
|
ErrorLog /var/log/apache2/${MIOURL_API}-error.log
|
|||
|
|
CustomLog /var/log/apache2/${MIOURL_API}-access.log combined
|
|||
|
|
</VirtualHost>
|
|||
|
|
|
|||
|
|
# HTTPS (proxy verso backend)
|
|||
|
|
<VirtualHost *:443>
|
|||
|
|
ServerName ${MIOURL_API}
|
|||
|
|
ServerAdmin surya@riso.app
|
|||
|
|
|
|||
|
|
SSLEngine on
|
|||
|
|
SSLCertificateFile /etc/letsencrypt/live/${MIODOMINIO}/fullchain.pem
|
|||
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/${MIODOMINIO}/privkey.pem
|
|||
|
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
|||
|
|
Protocols h2 http/1.1
|
|||
|
|
|
|||
|
|
ProxyPreserveHost On
|
|||
|
|
|
|||
|
|
# ===== SCEGLI UNO DEI DUE BLOCCHI, in base al TUO backend su ${PORTA} =====
|
|||
|
|
# --- Backend HTTP (più comune) ---
|
|||
|
|
# ProxyPass / http://127.0.0.1:${PORTA}/ retry=0 timeout=310 connectiontimeout=30
|
|||
|
|
# ProxyPassReverse / http://127.0.0.1:${PORTA}/
|
|||
|
|
|
|||
|
|
# --- Backend HTTPS (nel tuo caso probabile, visto l’“Empty reply” via HTTP) ---
|
|||
|
|
SSLProxyEngine On
|
|||
|
|
SSLProxyVerify none
|
|||
|
|
SSLProxyCheckPeerName off
|
|||
|
|
ProxyPass / https://127.0.0.1:${PORTA}/ retry=0 timeout=310 connectiontimeout=30
|
|||
|
|
ProxyPassReverse / https://127.0.0.1:${PORTA}/
|
|||
|
|
# ==========================================================================
|
|||
|
|
|
|||
|
|
<Proxy *>
|
|||
|
|
Require all granted
|
|||
|
|
</Proxy>
|
|||
|
|
|
|||
|
|
ProxyTimeout 310
|
|||
|
|
Timeout 310
|
|||
|
|
ProxyBadHeader Ignore
|
|||
|
|
|
|||
|
|
ErrorLog /var/log/apache2/${MIOURL_API}-error.log
|
|||
|
|
CustomLog /var/log/apache2/${MIOURL_API}-access.log combined
|
|||
|
|
</VirtualHost>
|