nginx.conf.j2 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # https://laravel.com/docs/12.x/deployment#nginx
  2. server {
  3. server_name {{ app_domain }};
  4. root /bla-bla-bla;
  5. add_header X-Frame-Options "SAMEORIGIN";
  6. add_header X-Content-Type-Options "nosniff";
  7. index index.php index.html;
  8. charset utf-8;
  9. gzip_comp_level 9;
  10. gzip_min_length 1k;
  11. gzip_types text/plain text/css application/xml application/javascript;
  12. gzip_vary on;
  13. client_max_body_size 512M;
  14. access_log {{ app_deploy_target | dirname }}/logs/nginx/access.log;
  15. error_log {{ app_deploy_target | dirname }}/logs/nginx/error.log warn;
  16. # access_log syslog:server=unix:/dev/log,tag={{ app_domain }},nohostname,severity=info combined;
  17. # error_log syslog:server=unix:/dev/log,tag={{ app_domain }},nohostname,severity=error;
  18. location {{ app_dashboard_base_path }}/ {
  19. alias /bla-bla-bla;
  20. try_files $uri $uri/ {{ app_dashboard_base_path }}/index.html;
  21. location ~* \.(css|js|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ {
  22. access_log off;
  23. expires max;
  24. }
  25. }
  26. location / {
  27. try_files $uri $uri/ /index.php?$query_string;
  28. }
  29. location = /favicon.ico { access_log off; log_not_found off; }
  30. location = /robots.txt { access_log off; log_not_found off; }
  31. error_page 404 /index.php;
  32. location ~ \.php$ {
  33. fastcgi_pass php_fpm_{{ app_php_fpm_port }};
  34. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  35. # for nginx v1.18
  36. # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  37. include fastcgi_params;
  38. fastcgi_hide_header X-Powered-By;
  39. }
  40. location ~ /\.(?!well-known).* {
  41. deny all;
  42. }
  43. }