Advertisement
Guest User

nginx.conf

a guest
Mar 22nd, 2012
1,453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. worker_processes 2; # Default 1
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. keepalive_timeout 65;
  9. ## Compression
  10. gzip on;
  11. gzip_buffers 16 8k;
  12. gzip_comp_level 9;
  13. gzip_http_version 1.1;
  14. gzip_min_length 10;
  15. gzip_types text/plain text/css application/x-javascript text/xml;
  16. gzip_vary on;
  17. gzip_static on; #Needs compilation with gzip_static support
  18. gzip_proxied any;
  19. gzip_disable "MSIE [1-6]\.";
  20. client_max_body_size 300m; //выставляем в соответствии с тем, сколько выставили в php.ini
  21. server {
  22. listen 80;
  23. server_name localhost;
  24. root /srv/http/;
  25. index index.php index.html;
  26. client_body_buffer_size 1m;
  27. proxy_buffering on;
  28. proxy_buffer_size 4k;
  29. proxy_buffers 8 32k;
  30. # To avoid bandwidth steal
  31. location ~* \.(js|css|jpg|jpeg|gif|png|svg)$ {
  32. valid_referers server_names blocked none ;
  33. if ($invalid_referer) {
  34. return 403;
  35. break;
  36. }
  37. if (-f $request_filename) {
  38. expires 35d;
  39. add_header Cache-Control public;
  40. break;
  41. }
  42. }
  43.  
  44. add_header Expires "Tue, 08 Sep 1973 07:00:00 GMT";
  45. add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
  46.  
  47. # This sends the php to Apache, running on port 81
  48. location / {
  49. proxy_pass http://localhost:81;
  50. proxy_set_header X-Real-IP $remote_addr;
  51. proxy_set_header Host $host;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. }
  54. # redirect server error pages to the static page /50x.html
  55. error_page 500 502 503 504 /50x.html;
  56. location = /50x.html {
  57. root html;
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement