Advertisement
Guest User

Untitled

a guest
Jun 11th, 2011
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. user apache;
  2. worker_processes 8;
  3. worker_rlimit_nofile 100000;
  4.  
  5. error_log /var/log/nginx/error.log debug;
  6.  
  7. pid /var/run/nginx.pid;
  8.  
  9.  
  10. events {
  11. worker_connections 1024;
  12. use epoll;
  13. }
  14.  
  15.  
  16. http {
  17. include /etc/nginx/mime.types;
  18. default_type application/octet-stream;
  19.  
  20. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  21. '$status $body_bytes_sent "$http_referer" '
  22. '"$http_user_agent" "$http_x_forwarded_for"';
  23.  
  24. access_log /var/log/nginx/access.log main;
  25. access_log on;
  26.  
  27. sendfile on;
  28. tcp_nopush on;
  29. tcp_nodelay on;
  30. server_tokens on;
  31. gzip on;
  32. gzip_static on;
  33. gzip_comp_level 1;
  34. gzip_min_length 1024;
  35. #Note, text/html is on by default in nginx
  36. gzip_types text/css application/x-javascript text/xml application/rss+xml
  37. keepalive_timeout 50;
  38. keepalive_requests 100;
  39. limit_zone myzone $binary_remote_addr 10m;
  40.  
  41. # Load config files from the /etc/nginx/conf.d directory
  42. include /etc/nginx/conf.d/*.conf;
  43.  
  44. server {
  45. ## Redirect to Domain if $host does not match www.domain.com
  46. listen 80 default_server;
  47. server_name _;
  48. rewrite ^ http://www.domain.com/vb$request_uri permanent;
  49. }
  50. server {
  51. limit_conn myzone 20;
  52. listen 80;
  53. server_name www.domain.com;
  54. root /var/www/html;
  55. index index.php index.html index.shtml index.htm;
  56. client_max_body_size 2M;
  57.  
  58. #charset koi8-r;
  59.  
  60.  
  61. ## Tell browsers to cache these files for 90 days and serve them directly
  62. location ~* \.(jpg|jpeg|gif|css|png|ico|js)$ {
  63. expires 90d;
  64. }
  65.  
  66.  
  67. location / {
  68. ## Enable Server Side Includes for /
  69. ssi on;
  70.  
  71. ## If the file exists as a static file serve it directly without
  72. ## running all the other rewite tests on it;
  73. try_files $uri $uri/ @IndexRewrites;
  74. }
  75.  
  76. location @IndexRewrites {
  77. rewrite <ALL REWRITES REMOVED FOR PASTEBIN>;
  78. }
  79.  
  80.  
  81. # WordPress single blog rules.
  82. # Designed to be included in any server {} block.
  83. # Based on http://codex.wordpress.org/Nginx
  84.  
  85. # This order might seem weird - this is attempted to match last if rules below fail.
  86. # http://wiki.nginx.org/HttpCoreModule
  87. location /blog/ {
  88. try_files $uri $uri/ /blog/index.php?$args;
  89.  
  90. # Add trailing slash to */wp-admin requests.
  91. rewrite /blog/wp-admin$ $scheme://$host$uri/ permanent;
  92.  
  93. # Uncomment one of the lines below for the appropriate caching plugin (if used).
  94. include wordpress-wp-super-cache.conf;
  95. }
  96.  
  97.  
  98. ## Rewriterule to make vBseo forum links work
  99. ## Based on http://www.axivo.com/community/threads/proper-vbseo-rewrite-rules-for-vbulletin-3.123
  100. location /vb/ {
  101. try_files $uri $uri/ @vbseo;
  102. }
  103. location @vbseo {
  104. fastcgi_pass unix:/dev/shm/php.sock;
  105. fastcgi_param SCRIPT_FILENAME $document_root/vb/vbseo.php;
  106. fastcgi_param QUERY_STRING vbseourl=$request_uri;
  107. include fastcgi_params;
  108. internal;
  109. }
  110. location = /vb/inlinemod.php {
  111. fastcgi_pass unix:/dev/shm/php.sock;
  112. fastcgi_param SCRIPT_FILENAME $document_root/vb/vbseo.php;
  113. fastcgi_param QUERY_STRING vbseourl=$request_uri;
  114. include fastcgi_params;
  115. }
  116.  
  117.  
  118. error_page 403 404 /e404.php;
  119.  
  120.  
  121. # Pass all .php files onto a php-fpm/php-fcgi server.
  122. # Based on https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/
  123. location ~ \.php$ {
  124. # Zero-day exploit defense.
  125. # http://forum.nginx.org/read.php?2,88845,page=3
  126. # Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
  127. # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
  128. try_files $uri =404;
  129.  
  130. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  131. include fastcgi_params;
  132. fastcgi_index index.php;
  133. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  134. fastcgi_pass unix:/dev/shm/php.sock;
  135. }
  136.  
  137.  
  138. # deny access to .htaccess files, if Apache's document root
  139. # concurs with nginx's one
  140. #
  141. location ~ /\.ht {
  142. deny all;
  143. }
  144. }
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement