2020#
2121server {
2222 charset utf-8;
23- source_charset utf-8;
24- server_tokens off;
25- disable_symlinks off;
26- keepalive_timeout 60;
27- client_max_body_size 50M;
23+ source_charset utf-8;
24+ server_tokens off;
25+ disable_symlinks off;
26+ keepalive_timeout 60;
27+ client_max_body_size 50M;
2828
2929 add_header X-Frame-Options "SAMEORIGIN";
30- add_header X-XSS-Protection "1; mode=block";
31- add_header X-Content-Type-Options "nosniff";
30+ add_header X-XSS-Protection "1; mode=block";
31+ add_header X-Content-Type-Options "nosniff";
3232
3333 listen 80 default_server;
3434 listen [::]:80 default_server;
35-
36- access_log /var/log/nginx/app_access.log;
37- error_log /var/log/nginx/app_error.log;
35+
36+ access_log /var/log/nginx/app_access.log;
37+ error_log /var/log/nginx/app_error.log;
3838
3939 # SSL configuration
4040 #
@@ -54,7 +54,7 @@ server {
5454
5555 root /var/www/html/public;
5656
57- # Add index.php to the list if you are using PHP
57+ # Add index.php to the list if you are using PHP
5858 index index.php index.html index.htm index.nginx-debian.html;
5959
6060 server_name _;
@@ -68,64 +68,64 @@ server {
6868 # pass PHP scripts to FastCGI server
6969 location ~ \.php$ {
7070 # include snippets/fastcgi-php.conf;
71-
72- # Add snippets fom snippets/fastcgi-php.conf
73- # regex to split $uri to $fastcgi_script_name and $fastcgi_path
74- fastcgi_split_path_info ^(.+?\.php)(/.*)$;
75- # Check that the PHP script exists before passing it
76- try_files $fastcgi_script_name =404;
77- # Bypass the fact that try_files resets $fastcgi_path_info
78- # see: http://trac.nginx.org/nginx/ticket/321
79- set $path_info $fastcgi_path_info;
80- fastcgi_param PATH_INFO $path_info;
81-
82- fastcgi_index index.php;
83- include fastcgi.conf;
71+
72+ # Add snippets fom snippets/fastcgi-php.conf
73+ # regex to split $uri to $fastcgi_script_name and $fastcgi_path
74+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
75+ # Check that the PHP script exists before passing it
76+ try_files $fastcgi_script_name =404;
77+ # Bypass the fact that try_files resets $fastcgi_path_info
78+ # see: http://trac.nginx.org/nginx/ticket/321
79+ set $path_info $fastcgi_path_info;
80+ fastcgi_param PATH_INFO $path_info;
81+
82+ fastcgi_index index.php;
83+ include fastcgi.conf;
8484
8585 # With php-fpm (or other unix sockets):
8686 # fastcgi_pass unix:/run/php/php8.2-fpm.sock;
8787 # With php-cgi (or other tcp sockets):
88- # With ip
88+ # With ip
8989 fastcgi_pass 127.0.0.1:9000;
9090 # Remove RUN nginx -t in Dockerfile if ypu want this
9191 # fastcgi_pass app:9000;
9292 }
9393
9494 location /storage {
95- location ~ \.php$ {return 403;}
96- }
97-
98- location ~ /(cache|secret|.git|vendor) {
99- deny all;
100- return 404;
101- }
102-
103- location ~* \.(html|js|ts|css|png|jpg|jpeg|gif|webp|svg|flv|pdf|mp3|mp4|mov|xml|ico)$ {
104- gzip on;
105- gzip_static on;
106- add_header Cache-Control 'public, no-transform';
107- add_header 'Set-Cookie' '';
108- fastcgi_hide_header 'Set-Cookie';
109- fastcgi_hide_header 'Cookie';
110- log_not_found off;
111- access_log off;
112- expires -1;
113- }
114-
115- location = /favicon.ico {
116- access_log off;
117- log_not_found off;
118- }
119-
120- location = /robots.txt {
121- access_log off;
122- log_not_found off;
123- }
124-
125- # deny access to .htaccess files, if Apache's document root concurs with nginx's one
126- location ~ /\.ht {
127- deny all;
128- }
95+ location ~ \.php$ {return 403;}
96+ }
97+
98+ location ~ /(cache|secret|.git|vendor) {
99+ deny all;
100+ return 404;
101+ }
102+
103+ location ~* \.(html|js|ts|css|png|jpg|jpeg|gif|webp|svg|flv|pdf|mp3|mp4|mov|xml|ico)$ {
104+ gzip on;
105+ gzip_static on;
106+ add_header Cache-Control 'public, no-transform';
107+ add_header 'Set-Cookie' '';
108+ fastcgi_hide_header 'Set-Cookie';
109+ fastcgi_hide_header 'Cookie';
110+ log_not_found off;
111+ access_log off;
112+ expires -1;
113+ }
114+
115+ location = /favicon.ico {
116+ access_log off;
117+ log_not_found off;
118+ }
119+
120+ location = /robots.txt {
121+ access_log off;
122+ log_not_found off;
123+ }
124+
125+ # deny access to .htaccess files, if Apache's document root concurs with nginx's one
126+ location ~ /\.ht {
127+ deny all;
128+ }
129129}
130130
131131
0 commit comments