blob: 3942bf60076201bfcc2be1830269528cb515b692 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<VirtualHost *:80>
ServerName ${FQDN}
# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>
<VirtualHost *:443>
ServerName ${FQDN}
# SSL Configuration (adjust paths as needed)
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/${FQDN}/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/${FQDN}/privkey.pem
# Document root for static files served directly by Apache
DocumentRoot /site/${FQDN}/public
# Serve static files directly via Apache (bypasses Go app)
<Directory /site/${FQDN}/public>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
# Cache static assets
<FilesMatch "\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
</Directory>
# Static files served by Apache
Alias /static /site/${FQDN}/public
# Proxy all other requests to Go application
ProxyPreserveHost On
ProxyPass /static !
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
# Logging
ErrorLog ${APACHE_LOG_DIR}/${FQDN}-error.log
CustomLog ${APACHE_LOG_DIR}/${FQDN}-access.log combined
</VirtualHost>
|