|
| 1 | +server { |
| 2 | + listen 80; |
| 3 | + listen [::]:80; |
| 4 | + server_name www.laravel.test; |
| 5 | + rewrite ^(.*) https://laravel.test$1/ permanent; |
| 6 | +} |
| 7 | + |
| 8 | +server { |
| 9 | + listen 80; |
| 10 | + listen [::]:80; |
| 11 | + server_name laravel.test; |
| 12 | + rewrite ^(.*) https://laravel.test$1/ permanent; |
| 13 | +} |
| 14 | + |
| 15 | +server { |
| 16 | + listen 443 ssl ; |
| 17 | + listen [::]:443 ssl; |
| 18 | + ssl_certificate /etc/nginx/ssl/laravel.test.crt; |
| 19 | + ssl_certificate_key /etc/nginx/ssl/laravel.test.key; |
| 20 | + server_name www.laravel.test; |
| 21 | + rewrite ^(.*) https://laravel.test$1/ permanent; |
| 22 | +} |
| 23 | + |
| 24 | +server { |
| 25 | + server_name laravel.test; |
| 26 | + |
| 27 | + # For https |
| 28 | + listen 443 ssl ; |
| 29 | + listen [::]:443 ssl; |
| 30 | + ssl_certificate /etc/nginx/ssl/laravel.test.crt; |
| 31 | + ssl_certificate_key /etc/nginx/ssl/laravel.test.key; |
| 32 | + |
| 33 | + port_in_redirect off; |
| 34 | + |
| 35 | + add_header Strict-Transport-Security "max-age=31536000"; |
| 36 | + add_header X-Content-Type-Options nosniff; |
| 37 | + |
| 38 | + location / { |
| 39 | + proxy_pass http://proxy:6081; |
| 40 | + proxy_set_header Host $http_host; |
| 41 | + proxy_set_header X-Forwarded-Host $http_host; |
| 42 | + proxy_set_header X-Real-IP $remote_addr; |
| 43 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 44 | + proxy_set_header X-Forwarded-Proto https; |
| 45 | + proxy_set_header HTTPS "on"; |
| 46 | + proxy_redirect off; |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +server { |
| 51 | + server_name laravel.test; |
| 52 | + |
| 53 | + listen 81; |
| 54 | + listen [::]:81; |
| 55 | + |
| 56 | + root /var/www/laravel.test/www; |
| 57 | + |
| 58 | + index index.php index.html index.htm; |
| 59 | + |
| 60 | + location / { |
| 61 | + try_files $uri $uri/ /index.php$is_args$args; |
| 62 | + } |
| 63 | + |
| 64 | + location ~ \.php$ { |
| 65 | + fastcgi_max_temp_file_size 4m; |
| 66 | + fastcgi_pass php-upstream; |
| 67 | + |
| 68 | + # Additional configs |
| 69 | + fastcgi_pass_header Set-Cookie; |
| 70 | + fastcgi_pass_header Cookie; |
| 71 | + fastcgi_ignore_headers Cache-Control Expires Set-Cookie; |
| 72 | + try_files $uri /index.php =404; |
| 73 | + fastcgi_index index.php; |
| 74 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 75 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| 76 | + fastcgi_param PATH_INFO $fastcgi_path_info; |
| 77 | + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; |
| 78 | + fastcgi_param HTTPS on; |
| 79 | + |
| 80 | + fastcgi_buffers 16 16k; |
| 81 | + fastcgi_buffer_size 32k; |
| 82 | + |
| 83 | + fastcgi_intercept_errors on; |
| 84 | + |
| 85 | + #fixes timeouts |
| 86 | + fastcgi_read_timeout 600; |
| 87 | + include fastcgi_params; |
| 88 | + } |
| 89 | + |
| 90 | + # Caching |
| 91 | + location ~* \.(ico|jpg|webp|jpeg|gif|css|png|js|ico|bmp|zip|woff)$ { |
| 92 | + access_log off; |
| 93 | + log_not_found off; |
| 94 | + add_header Pragma public; |
| 95 | + add_header Cache-Control "public"; |
| 96 | + expires 14d; |
| 97 | + } |
| 98 | + |
| 99 | + location ~* \.(php|html)$ { |
| 100 | + access_log on; |
| 101 | + log_not_found on; |
| 102 | + add_header Pragma public; |
| 103 | + add_header Cache-Control "public"; |
| 104 | + expires 14d; |
| 105 | + } |
| 106 | + |
| 107 | + location ~ /\.ht { |
| 108 | + deny all; |
| 109 | + } |
| 110 | +} |
0 commit comments