20
20
#
21
21
server {
22
22
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;
28
28
29
29
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";
32
32
33
33
listen 80 default_server;
34
34
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;
38
38
39
39
# SSL configuration
40
40
#
@@ -54,7 +54,7 @@ server {
54
54
55
55
root /var/www/html/public;
56
56
57
- # Add index.php to the list if you are using PHP
57
+ # Add index.php to the list if you are using PHP
58
58
index index.php index.html index.htm index.nginx-debian.html;
59
59
60
60
server_name _;
@@ -68,64 +68,64 @@ server {
68
68
# pass PHP scripts to FastCGI server
69
69
location ~ \.php$ {
70
70
# 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;
84
84
85
85
# With php-fpm (or other unix sockets):
86
86
# fastcgi_pass unix:/run/php/php8.2-fpm.sock;
87
87
# With php-cgi (or other tcp sockets):
88
- # With ip
88
+ # With ip
89
89
fastcgi_pass 127.0.0.1:9000;
90
90
# Remove RUN nginx -t in Dockerfile if ypu want this
91
91
# fastcgi_pass app:9000;
92
92
}
93
93
94
94
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
+ }
129
129
}
130
130
131
131
0 commit comments