86 lines
2.3 KiB
Nginx Configuration File
86 lines
2.3 KiB
Nginx Configuration File
server {
|
|
listen 8000 default_server;
|
|
listen [::]:8000 default_server;
|
|
|
|
server_name _;
|
|
|
|
root /app/code/public;
|
|
index index.php index.html;
|
|
|
|
# Logging to stdout/stderr
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
# 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;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# Client body size
|
|
client_max_body_size 25M;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
# Deny access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
# PHP-FPM configuration
|
|
location ~ \.php$ {
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
|
|
fastcgi_index index.php;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
fastcgi_param HTTP_PROXY "";
|
|
|
|
# Proxy headers for Cloudron
|
|
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
|
fastcgi_param HTTP_X_FORWARDED_PROTO $scheme;
|
|
fastcgi_param HTTP_HOST $host;
|
|
|
|
fastcgi_intercept_errors off;
|
|
fastcgi_buffer_size 16k;
|
|
fastcgi_buffers 4 16k;
|
|
fastcgi_connect_timeout 300;
|
|
fastcgi_send_timeout 300;
|
|
fastcgi_read_timeout 300;
|
|
}
|
|
|
|
# Static files caching
|
|
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml|svg|woff|woff2|ttf|eot)$ {
|
|
expires 30d;
|
|
access_log off;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Deny access to sensitive files
|
|
location ~ /\.(?!well-known).* {
|
|
deny all;
|
|
}
|
|
}
|