i hate nginx

This commit is contained in:
2025-06-01 03:34:22 +02:00
parent db0fe61673
commit d8b4bc33da
2 changed files with 36 additions and 9 deletions

12
docker-compose.yml Normal file
View File

@@ -0,0 +1,12 @@
version: '3.8'
services:
nginx:
image: nginx:alpine
container_name: website-nginx
ports:
- "8097:80"
volumes:
- /opt/docker/Website:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
restart: unless-stopped

View File

@@ -1,11 +1,26 @@
server {
listen 8097;
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.html;
try_files $uri $uri/ =404;
}
# Enable gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Cache static assets
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
}