116 lines
3.8 KiB
Plaintext
116 lines
3.8 KiB
Plaintext
<VirtualHost *:80>
|
|
ServerName your-domain.com
|
|
ServerAlias www.your-domain.com
|
|
DocumentRoot /var/www/bikeservice/backend/public
|
|
|
|
<Directory /var/www/bikeservice/backend/public>
|
|
AllowOverride All
|
|
Require all granted
|
|
|
|
# Laravel specific rules
|
|
RewriteEngine On
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule ^(.*)$ index.php [QSA,L]
|
|
</Directory>
|
|
|
|
# Security headers
|
|
Header always set X-Frame-Options "SAMEORIGIN"
|
|
Header always set X-XSS-Protection "1; mode=block"
|
|
Header always set X-Content-Type-Options "nosniff"
|
|
Header always set Referrer-Policy "no-referrer-when-downgrade"
|
|
Header always set Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'"
|
|
|
|
# Gzip compression
|
|
<Location />
|
|
SetOutputFilter DEFLATE
|
|
SetEnvIfNoCase Request_URI \
|
|
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
|
|
SetEnvIfNoCase Request_URI \
|
|
\.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
|
|
SetEnvIfNoCase Request_URI \
|
|
\.(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
|
|
</Location>
|
|
|
|
# Cache static assets
|
|
<LocationMatch "\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$">
|
|
ExpiresActive On
|
|
ExpiresDefault "access plus 1 year"
|
|
Header append Cache-Control "public, immutable"
|
|
Header append Vary Accept-Encoding
|
|
</LocationMatch>
|
|
|
|
# Cache API responses (no cache)
|
|
<LocationMatch "^/api/">
|
|
Header set Cache-Control "no-cache, no-store, must-revalidate"
|
|
Header set Pragma "no-cache"
|
|
Header set Expires "0"
|
|
</LocationMatch>
|
|
|
|
# Deny access to sensitive files
|
|
<FilesMatch "\.(env|log|sql|md|txt|yml|yaml|ini)$">
|
|
Require all denied
|
|
</FilesMatch>
|
|
|
|
# Deny access to hidden files
|
|
<FilesMatch "^\.">
|
|
Require all denied
|
|
</FilesMatch>
|
|
|
|
# Health check endpoint
|
|
<Location /health>
|
|
SetHandler server-status
|
|
Require all granted
|
|
</Location>
|
|
|
|
# Logging
|
|
ErrorLog ${APACHE_LOG_DIR}/bikeservice_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/bikeservice_access.log combined
|
|
|
|
# Client max body size (for file uploads)
|
|
LimitRequestBody 67108864
|
|
|
|
# Timeouts
|
|
Timeout 300
|
|
KeepAliveTimeout 5
|
|
MaxKeepAliveRequests 100
|
|
</VirtualHost>
|
|
|
|
# SSL Configuration (uncomment after obtaining SSL certificate)
|
|
# <VirtualHost *:443>
|
|
# ServerName your-domain.com
|
|
# ServerAlias www.your-domain.com
|
|
# DocumentRoot /var/www/bikeservice/backend/public
|
|
#
|
|
# SSLEngine on
|
|
# SSLCertificateFile /etc/letsencrypt/live/your-domain.com/fullchain.pem
|
|
# SSLCertificateKeyFile /etc/letsencrypt/live/your-domain.com/privkey.pem
|
|
#
|
|
# # Include all the same configuration as above
|
|
# <Directory /var/www/bikeservice/backend/public>
|
|
# AllowOverride All
|
|
# Require all granted
|
|
#
|
|
# RewriteEngine On
|
|
# RewriteCond %{REQUEST_FILENAME} !-f
|
|
# RewriteCond %{REQUEST_FILENAME} !-d
|
|
# RewriteRule ^(.*)$ index.php [QSA,L]
|
|
# </Directory>
|
|
#
|
|
# # Security headers
|
|
# Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
# Header always set X-Frame-Options "SAMEORIGIN"
|
|
# Header always set X-XSS-Protection "1; mode=block"
|
|
# Header always set X-Content-Type-Options "nosniff"
|
|
# Header always set Referrer-Policy "no-referrer-when-downgrade"
|
|
#
|
|
# # Same configuration as HTTP version...
|
|
# </VirtualHost>
|
|
|
|
# Redirect HTTP to HTTPS (uncomment after SSL setup)
|
|
# <VirtualHost *:80>
|
|
# ServerName your-domain.com
|
|
# ServerAlias www.your-domain.com
|
|
# Redirect permanent / https://your-domain.com/
|
|
# </VirtualHost>
|