Skip to content

Commit

Permalink
Merge pull request #379 from netlogix/feature/SHOPWARE-124-nginx-config
Browse files Browse the repository at this point in the history
Feature/shopware 124 nginx config
  • Loading branch information
sd-lueckel authored Jan 15, 2025
2 parents e8025e4 + ef83b63 commit 727c967
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
64 changes: 64 additions & 0 deletions nginx/etc/nginx/includes/shopware6
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
include includes/defaults;

root /var/www/public;

location ~ ^/(theme|media|thumbnail|bundles|css|fonts|js|recovery|sitemap)/ {
expires 1y;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
log_not_found off;
tcp_nodelay off;
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

location ~* ^.+\.svg {
add_header Content-Security-Policy "script-src 'none'";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
log_not_found off;
}
}

location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|svg|webp|html|woff|woff2|xml)$ {
expires 1y;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";

access_log off;

# The directive enables or disables messages in error_log about files not found on disk.
log_not_found off;

tcp_nodelay off;

## Set the OS file cache.
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

try_files $uri /index.php$is_args$args;
}

location ~* ^.+\.svg$ {
add_header Content-Security-Policy "script-src 'none'";
}

location / {
try_files $uri /index.php$is_args$args;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $request_filename;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;
client_body_buffer_size 128k;
fastcgi_pass shop_backend;
}
11 changes: 11 additions & 0 deletions nginx/examples/shopware6.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
upstream shop_backend {
server ${FPM_BACKEND};
}

server {
listen 80;

server_name ${SHOP_DOMAIN};

include includes/shopware6;
}

0 comments on commit 727c967

Please sign in to comment.