nginx.dist.conf 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #
  2. # Example nginx configuration for forkbb
  3. #
  4. server {
  5. listen 80; # 80 port only http:
  6. server_name forkbb.local *.forkbb.local; # you need to set your values
  7. root "/www/forkbb/public"; # you need to set your values
  8. autoindex off;
  9. charset utf-8;
  10. server_tokens off;
  11. location = /favicon.ico {
  12. access_log off;
  13. log_not_found off;
  14. expires 1w;
  15. etag off;
  16. }
  17. location = /robots.txt {
  18. access_log off;
  19. log_not_found off;
  20. }
  21. location / {
  22. fastcgi_hide_header X-Powered-By;
  23. fastcgi_index index.dist.php;
  24. include fastcgi_params;
  25. fastcgi_param HTTP_PROXY "";
  26. #fastcgi_param SCRIPT_FILENAME $document_root/index.dist.php;
  27. fastcgi_param SCRIPT_FILENAME $realpath_root/index.dist.php;
  28. fastcgi_param DOCUMENT_ROOT $realpath_root;
  29. fastcgi_pass php_upstream; # you need to set your values
  30. #or fastcgi_pass unix:/var/run/php-fpm.sock; # you need to set your values
  31. }
  32. location /js/ {
  33. location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
  34. try_files $1.$2 =404;
  35. add_header Cache-Control "public,max-age=31536000,immutable";
  36. etag off;
  37. }
  38. location ~ /\.ht {
  39. return 404;
  40. }
  41. location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
  42. try_files $uri =404;
  43. add_header Cache-Control "public,max-age=31536000,immutable";
  44. etag off;
  45. }
  46. }
  47. location /img/ {
  48. location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
  49. try_files $1.$2 =404;
  50. add_header Cache-Control "public,max-age=31536000,immutable";
  51. etag off;
  52. }
  53. location ~ /\.ht {
  54. return 404;
  55. }
  56. location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
  57. try_files $uri =404;
  58. add_header Cache-Control "public,max-age=31536000,immutable";
  59. etag off;
  60. }
  61. }
  62. location /style/ {
  63. location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
  64. try_files $1.$2 =404;
  65. add_header Cache-Control "public,max-age=31536000,immutable";
  66. etag off;
  67. }
  68. location ~ /\.ht {
  69. return 404;
  70. }
  71. location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
  72. try_files $uri =404;
  73. add_header Cache-Control "public,max-age=31536000,immutable";
  74. etag off;
  75. }
  76. }
  77. }