X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=.docker%2Fnginx.conf;h=30810a871b1bf2418a9ed73cab62b0bec8680cf3;hb=ce901a58289c72bf7f4dc3515a2be70562cd618b;hp=023f52c1d1be5f8502c0aad2567a054b7216eb05;hpb=8c5f6c786d00310b2e863aa316927effb7bfeedb;p=github%2Fshaarli%2FShaarli.git diff --git a/.docker/nginx.conf b/.docker/nginx.conf index 023f52c1..30810a87 100644 --- a/.docker/nginx.conf +++ b/.docker/nginx.conf @@ -17,27 +17,13 @@ http { index index.html index.php; server { - listen 80; - root /var/www/shaarli; + listen 80; + root /var/www/shaarli; access_log /var/log/nginx/shaarli.access.log; error_log /var/log/nginx/shaarli.error.log; - location ~ /\. { - # deny access to dotfiles - access_log off; - log_not_found off; - deny all; - } - - location ~ ~$ { - # deny access to temp editor files, e.g. "script.php~" - access_log off; - log_not_found off; - deny all; - } - - location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { + location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$ { # cache static assets expires max; add_header Pragma public; @@ -49,30 +35,25 @@ http { alias /var/www/shaarli/images/favicon.ico; } + location /doc/html/ { + default_type "text/html"; + try_files $uri $uri/ $uri.html =404; + } + location / { - # Slim - rewrite URLs - try_files $uri /index.php$is_args$args; + # Slim - rewrite URLs & do NOT serve static files through this location + try_files _ /index.php$is_args$args; } - location ~ (index)\.php$ { + location ~ index\.php$ { # Slim - split URL path into (script_filename, path_info) try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_split_path_info ^(index.php)(/.+)$; # filter and proxy PHP requests to PHP-FPM fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; include fastcgi.conf; } - - location ~ /doc/ { - default_type "text/html"; - try_files $uri $uri/ $uri.html =404; - } - - location ~ \.php$ { - # deny access to all other PHP scripts - deny all; - } } }