bifrost_nginx.conf 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. root /var/www/bifrost/htdocs;
  5. index index.php index.html index.htm;
  6. server_name bifrost;
  7. location / {
  8. try_files $uri $uri/ =404;
  9. autoindex on;
  10. }
  11. location ~ \.php$ {
  12. # regex to split $uri to $fastcgi_script_name and $fastcgi_path
  13. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  14. # Check that the PHP script exists before passing it
  15. try_files $fastcgi_script_name =404;
  16. # Bypass the fact that try_files resets $fastcgi_path_info
  17. # see: http://trac.nginx.org/nginx/ticket/321
  18. set $path_info $fastcgi_path_info;
  19. fastcgi_param PATH_INFO $path_info;
  20. fastcgi_index index.php;
  21. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  22. fastcgi_param QUERY_STRING $query_string;
  23. fastcgi_param REQUEST_METHOD $request_method;
  24. fastcgi_param CONTENT_TYPE $content_type;
  25. fastcgi_param CONTENT_LENGTH $content_length;
  26. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  27. fastcgi_param REQUEST_URI $request_uri;
  28. fastcgi_param DOCUMENT_URI $document_uri;
  29. fastcgi_param DOCUMENT_ROOT $document_root;
  30. fastcgi_param SERVER_PROTOCOL $server_protocol;
  31. fastcgi_param HTTPS $https if_not_empty;
  32. fastcgi_param GATEWAY_INTERFACE CGI/1.1;
  33. fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
  34. fastcgi_param REMOTE_ADDR $remote_addr;
  35. fastcgi_param REMOTE_PORT $remote_port;
  36. fastcgi_param SERVER_ADDR $server_addr;
  37. fastcgi_param SERVER_PORT $server_port;
  38. fastcgi_param SERVER_NAME $server_name;
  39. # PHP only, required if PHP was built with --enable-force-cgi-redirect
  40. fastcgi_param REDIRECT_STATUS 200;
  41. fastcgi_pass 127.0.0.1:9000;
  42. #Environments
  43. #fastcgi_param ENVIRONMENT 'production';
  44. fastcgi_param ENVIRONMENT 'development';
  45. #Application modes
  46. fastcgi_param APPLICATION 'frontend';
  47. #fastcgi_param APPLICATION 'cms';
  48. }
  49. error_log /var/log/nginx/bifrost_error.log warn;
  50. access_log /var/log/nginx/bifrost_access.log combined;
  51. }
  52. server {
  53. listen 80;
  54. listen [::]:80;
  55. root /var/www/bifrost/tests;
  56. index index.php index.html index.htm;
  57. server_name bifrost-tests;
  58. location / {
  59. try_files $uri $uri/ =404;
  60. autoindex on;
  61. }
  62. location ~ \.php$ {
  63. include snippets/fastcgi-php.conf;
  64. fastcgi_pass 127.0.0.1:9000;
  65. fastcgi_param ENVIRONMENT 'development';
  66. fastcgi_param APPLICATION 'frontend';
  67. }
  68. error_log /var/log/nginx/bifrost_test_error.log warn;
  69. access_log /var/log/nginx/bifrost_test_access.log combined;
  70. }
  71. server {
  72. listen 80;
  73. listen [::]:80;
  74. root /var/www/templates;
  75. index error.html;
  76. server_name bifrost-images;
  77. location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) {
  78. access_log off;
  79. add_header 'Cache-Control' 'public';
  80. add_header 'Cache-Control' 'must-revalidate';
  81. add_header 'Access-Control-Allow-Origin' '*';
  82. expires 30d;
  83. }
  84. }