Advertisement
Guest User

Nginx config

a guest
Feb 25th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. user nginx;
  2. worker_processes 8;
  3.  
  4. error_log /var/log/nginx/error.log;
  5. pid /var/run/nginx.pid;
  6.  
  7. worker_rlimit_nofile 32768;
  8.  
  9. events {
  10. worker_connections 20000;
  11. use epoll;
  12. multi_accept on;
  13. }
  14.  
  15. http {
  16. include /etc/nginx/mime.types;
  17. include /etc/nginx/fastcgi.conf;
  18. include /etc/nginx/proxy.conf;
  19.  
  20. index index.html index.htm index.php;
  21.  
  22. default_type application/octet-stream;
  23.  
  24. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  25. '$status $body_bytes_sent "$http_referer" '
  26. '"$http_user_agent" "$http_x_forwarded_for"';
  27.  
  28. access_log /var/log/nginx/access.log main;
  29.  
  30. server_tokens off;
  31. sendfile on;
  32. tcp_nopush on;
  33. tcp_nodelay on;
  34.  
  35. keepalive_timeout 2;
  36.  
  37. reset_timedout_connection on;
  38. gzip on;
  39. gzip_buffers 16 8k;
  40. gzip_comp_level 1;
  41. gzip_http_version 1.1;
  42. gzip_min_length 10;
  43. gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fontobject font/opentype application/x-font-ttf;
  44. gzip_vary on;
  45. gzip_proxied any;
  46. gzip_disable "msie6";
  47.  
  48. gzip_static on;
  49.  
  50. server {
  51. listen 80;
  52.  
  53. server_name _;
  54. server_name_in_redirect off;
  55.  
  56. root /var/www/html;
  57.  
  58. location / {
  59. error_page 404 /404;
  60.  
  61. location ~* ^.+\.(?:css|js|jpe?g|gif|ico|png|html|xml)$ {
  62. log_not_found off;
  63. access_log off;
  64. expires 30d;
  65. tcp_nodelay off;
  66. open_file_cache max=3000 inactive=120s;
  67. open_file_cache_valid 45s;
  68. open_file_cache_min_uses 2;
  69. open_file_cache_errors off;
  70. }
  71. location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
  72. return 404;
  73. }
  74.  
  75. try_files $uri $uri/ @proxy;
  76. }
  77.  
  78. location @proxy {
  79. try_files $uri $uri/ /index.php?q=$uri&$args;
  80. }
  81.  
  82. location ~ \.php$ {
  83. fastcgi_pass 127.0.0.1:9000;
  84. }
  85.  
  86. location ^~ /.git {
  87. return 404;
  88. }
  89.  
  90. location ~* ^.+\.php$ {
  91. return 404;
  92. }
  93. }
  94.  
  95. # Load config files from the /etc/nginx/conf.d directory
  96. include /etc/nginx/conf.d/*.conf;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement