# Nginx configuration server { listen 80 default_server; listen [::]:80 default_server; server_name localhost; index index.php index.html; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /var/www/html; sendfile off; location / { try_files $uri $uri/ /index.php?$args; include /etc/nginx/mime.types; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } # Adding the cache control header for js and css files # Make sure it is BELOW the PHP block location ~* \.(?:css|js)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control "public, max-age=7200"; # Add headers to serve security related headers (It is intended to # have those duplicated to the ones above) # Before enabling Strict-Transport-Security headers please read into # this topic first. # add_header Strict-Transport-Security "max-age=15768000; # includeSubDomains; preload;"; # # WARNING: Only add the preload option once you read about # the consequences in https://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. add_header X-Content-Type-Options nosniff; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; # Optional: Don't log access to assets access_log off; } location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args; # Optional: Don't log access to other assets access_log off; } } # server { # server_name localhost; # listen 443 ssl; # fastcgi_param HTTPS on; # ssl_certificate /etc/ssl/server.pem; # ssl_certificate_key /etc/ssl/server.key; # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; # index index.php index.html; # error_log /var/log/nginx/error.log; # access_log /var/log/nginx/access.log; # root /var/www/html/public; # location ~ \.php$ { # try_files $uri =404; # fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_pass php:9000; # fastcgi_index index.php; # include fastcgi_params; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param PATH_INFO $fastcgi_path_info; # } # }