Guest User

nginx config

a guest
Jul 27th, 2011
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. user www www;
  2. worker_processes 1;
  3.  
  4. error_log /var/log/nginx/error.log;
  5.  
  6. pid /var/run/nginx.pid;
  7.  
  8. events {
  9. worker_connections 1024;
  10. }
  11.  
  12.  
  13. http {
  14. include mime.types;
  15. default_type application/octet-stream;
  16. server_tokens off;
  17. # server_name_in_redirect off;
  18.  
  19. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  20. '$status $body_bytes_sent "$http_referer" '
  21. '"$http_user_agent" "$http_x_forwarded_for"';
  22.  
  23. sendfile on;
  24. tcp_nopush on;
  25. keepalive_timeout 10 5;
  26. # client_body_buffer_size 8k;
  27. # client_header_buffer_size 1k;
  28. # client_max_body_size 1;
  29. # large_client_header_buffers 1 1k;
  30. # client_body_timeout 5;
  31. # client_header_timeout 5;
  32. ignore_invalid_headers on;
  33. # limit_zone gulag $binary_remote_addr 1m;
  34. # recursive_error_pages on;
  35.  
  36. gzip on;
  37.  
  38.  
  39. server {
  40. listen 80;
  41. server_name foobar.dyndns.org;
  42. charset utf-8;
  43. access_log /var/log/nginx/foobar.access.log main;
  44. log_not_found off;
  45.  
  46. location / {
  47. root /usr/local/www/nginx;
  48. index index.php index.html;
  49. error_page 404 /404.html;
  50. error_page 500 502 503 504 /50x.hmtl;
  51. }
  52.  
  53. location /blog/ {
  54. try_files $uri $uri/ /index.php?q=$uri&$args;
  55. }
  56.  
  57. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  58. location ~ \.php$ {
  59. fastcgi_pass 127.0.0.1:9000;
  60. fastcgi_index index.php;
  61. fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
  62. include fastcgi_params;
  63. }
  64.  
  65. # location /blog/ {
  66. # try_files $uri $uri/ /index.php?q=$uri&$args;
  67. # }
  68.  
  69. # location /blog/ {
  70. # if (!-e $request_filename) {
  71. # rewrite ^.*$ /index.php last;
  72. # }
  73. # }
  74.  
  75. location ~ /\.ht {
  76. deny all;
  77. }
  78. ## Only allow GET and HEAD and POST request methods
  79. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
  80. return 444;
  81. }
  82. ## Deny certain Referers (case insensitive)
  83. ## The ~* makes it case insensitive as opposed to just a ~
  84. if ($http_referer ~* (babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|video|webcam|zippo) ) {
  85. return 444;
  86. }
  87. }
  88. }
Add Comment
Please, Sign In to add comment