|
1 | | -# open_file_cache max=10000 inactive=5m; |
2 | | -# open_file_cache_valid 1m; |
3 | | -# open_file_cache_min_uses 1; |
4 | | -# open_file_cache_errors on; |
| 1 | +# vim: ft=nginx ts=2 sw=2 |
5 | 2 |
|
6 | 3 | server { |
7 | | - listen 80 default_server; |
8 | | - listen [::]:80 default_server ipv6only=on; |
| 4 | + listen 80 default_server; |
| 5 | + listen [::]:80 default_server ipv6only=on; |
9 | 6 |
|
10 | | - add_header X-Frame-Options "SAMEORIGIN"; |
11 | | - add_header X-XSS-Protection "1; mode=block"; |
| 7 | + add_header X-Frame-Options "SAMEORIGIN"; |
| 8 | + add_header X-XSS-Protection "1; mode=block"; |
12 | 9 |
|
| 10 | + # Make site accessible from http://localhost/ |
| 11 | + server_name localhost; |
| 12 | + |
| 13 | + location / { |
13 | 14 | root /var/www/html; |
14 | 15 | index index.php index.html index.htm; |
15 | 16 |
|
16 | | - # Make site accessible from http://localhost/ |
17 | | - server_name localhost; |
18 | | - |
19 | | - location / { |
20 | | - server_tokens off; |
21 | | - # First attempt to serve request as file, then as directory, then |
22 | | - # /index.php. |
23 | | - try_files $uri $uri/ @reroute; |
24 | | - # Uncomment to enable naxsi on this location |
25 | | - # include /etc/nginx/naxsi.rules |
26 | | - } |
27 | | - |
28 | | - location = /favicon.ico { log_not_found off; access_log off; } |
29 | | - location = /robots.txt { access_log off; log_not_found off; } |
30 | | - |
31 | | - location @reroute { |
32 | | - rewrite ^ /index.php last; |
33 | | - } |
34 | | - |
35 | | - # error_page 404 /index.php; |
36 | | - |
37 | | - # pass the PHP scripts to php-fpm |
38 | | - # Note: \.php$ is susceptible to file upload attacks |
39 | | - # Consider using: "location ~ ^/(index|app|app_dev|config)\.php(/|$) {" |
40 | | - location ~ \.php$ { |
41 | | - fastcgi_split_path_info ^(.+\.php)(/.+)$; |
42 | | - # With php5-fpm: |
43 | | - fastcgi_pass unix:/run/php/php7.1-fpm.sock; |
44 | | - fastcgi_index index.php; |
45 | | - include fastcgi_params; |
46 | | - include fastcgi.conf; |
47 | | - fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; |
48 | | - fastcgi_param LARA_ENV local; # Environment variable for Laravel |
49 | | - fastcgi_param HTTPS off; |
50 | | - } |
51 | | - |
52 | | - # deny access to .htaccess files, if Apache's document root |
53 | | - # concurs with nginx's one |
54 | | - |
55 | | - location ~ /\.ht { |
56 | | - deny all; |
57 | | - } |
| 17 | + server_tokens off; |
| 18 | + # First attempt to serve request as file, then as directory, then |
| 19 | + # /index.php. |
| 20 | + try_files $uri $uri/ @reroute; |
| 21 | + # include /etc/nginx/naxsi.rules |
| 22 | + } |
| 23 | + |
| 24 | + location = /favicon.ico { log_not_found off; access_log off; } |
| 25 | + location = /robots.txt { access_log off; log_not_found off; } |
| 26 | + |
| 27 | + location @reroute { |
| 28 | + rewrite ^ /index.php last; |
| 29 | + } |
| 30 | + |
| 31 | + # error_page 404 /index.php; |
| 32 | + |
| 33 | + # pass the PHP scripts to php-fpm |
| 34 | + # Note: \.php$ is susceptible to file upload attacks |
| 35 | + # Consider using: "location ~ ^/(index|app|app_dev|config)\.php(/|$) {" |
| 36 | + location ~ \.php$ { |
| 37 | + root /var/www/html; |
| 38 | + fastcgi_index index.php; |
| 39 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| 40 | + fastcgi_pass unix:/run/php/php7.1-fpm.sock; |
| 41 | + include fastcgi_params; |
| 42 | + fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; |
| 43 | + fastcgi_param LARA_ENV local; # Environment variable for Laravel |
| 44 | + fastcgi_param HTTPS off; |
| 45 | + } |
| 46 | + |
| 47 | + # deny access to .htaccess files, if Apache's document root |
| 48 | + # concurs with nginx's one |
| 49 | + |
| 50 | + location ~ /\.ht { |
| 51 | + deny all; |
| 52 | + } |
58 | 53 | } |
0 commit comments