Guest User

Untitled

a guest
Feb 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. server {
  2. set $website_host "mywonderfulwebsite.org";
  3. set $website_root "/var/www/mywonderfulwebsite/web";
  4. set $default_controller "index.php";
  5. set $symfony_root "/var/www/mywonderfulwebsite/lib/vendor/symfony";
  6.  
  7. listen 80;
  8. server_name $website_host;
  9.  
  10. # Gzip
  11. gzip on;
  12. gzip_min_length 1000;
  13. gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  14. gzip_disable "MSIE [1-6]\.";
  15.  
  16. access_log /var/log/nginx/$website_host.access.log;
  17.  
  18. root $website_root;
  19.  
  20. index $default_controller;
  21.  
  22. charset utf-8;
  23.  
  24. location /sf {
  25. # path to folder where all symfony assets are located
  26. alias $symfony_root/data/web/sf;
  27. expires max;
  28. }
  29.  
  30. location / {
  31. # If the file exists as a static file serve it directly without
  32. # running all the other rewite tests on it
  33. if (-f $request_filename) {
  34. expires max;
  35. break;
  36. }
  37.  
  38. if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") {
  39. rewrite ^(.*) /$default_controller$1 last;
  40. }
  41. }
  42.  
  43. location ~ "^(.+\.php)($|/)" {
  44.  
  45. set $script $uri;
  46. set $path_info "/";
  47.  
  48. if ($uri ~ "^(.+\.php)($|/)") {
  49. set $script $1;
  50. }
  51.  
  52. if ($uri ~ "^(.+\.php)(/.+)") {
  53. set $script $1;
  54. set $path_info $2;
  55. }
  56.  
  57. include /etc/nginx/fastcgi_params;
  58. fastcgi_pass 127.0.0.1:9000;
  59.  
  60. fastcgi_param SCRIPT_FILENAME $website_root$script;
  61. fastcgi_param SCRIPT_NAME $script;
  62. fastcgi_param PATH_INFO $path_info;
  63. }
  64. }
Add Comment
Please, Sign In to add comment