Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Feb 14, 2011 1:23 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
Cant seem to get this right. I used VladGh's LEMP script to perform the install which produces the following nginx.conf:

Code:
user www-data;
worker_processes     4;
error_log  /var/log/nginx/nginx.log info;
pid        /var/run/nginx.pid;

events {
  worker_connections  1024;
  multi_accept on;
}

http {
  include           fastcgi.conf;
  include           mime.types;
  default_type      application/octet-stream;
  set_real_ip_from  127.0.0.1;
  real_ip_header    X-Forwarded-For;
   
  ## Proxy
  proxy_redirect          off;
  proxy_set_header        Host  $host;
  proxy_set_header        X-Real-IP $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  client_max_body_size    10m;
  client_body_buffer_size 128k;
  proxy_connect_timeout   90;
  proxy_send_timeout      90;
  proxy_read_timeout      90;
  proxy_buffers           32 4k;

  ## Compression
  gzip             on;
  gzip_types       text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  gzip_disable     "MSIE [1-6]\.(?!.*SV1)";

  ### TCP options
  tcp_nodelay         on;
  tcp_nopush          on;
  keepalive_timeout   65;
  sendfile            on;

  server {

    server_name _ "";

    access_log  /var/log/nginx/$host.access.log;
    error_log   /var/log/nginx/error.log;

    root    /var/www;
    index   index.php index.html;

    ## Block bad bots
    if ($http_user_agent ~* (HTTrack|HTMLParser|libcurl|discobot|Exabot|Casper|kmccrew|plaNETWORK|RPT-HTTPClient)) {
      return 444;
    }

    ## Block certain Referers (case insensitive)
    if ($http_referer ~* (sex|vigra|viagra) ) {
      return 444;
    }

    ## Deny dot files:
    location ~ /\. {
      deny all;
    }

    ## Favicon Not Found
    location = /favicon.ico {
      access_log off;
      log_not_found off;
    }

    ## Robots.txt Not Found
    location = /robots.txt {
      access_log off;
      log_not_found off;
    }

    location / {
      try_files $uri $uri/ index.php;
    } 

    location ~ \.php$ {
      include /etc/nginx/fastcgi.conf;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    ### NginX Status
    location /nginx_status {
    stub_status on;
      access_log   off;
    }

    ### FPM Status
    location ~ ^/(status|ping)$ {
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      access_log      off;
    }

  }

}



I just need to add the following from my previous apache setup:

Code:
RewriteEngine On
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

RewriteRule ^includes/(.*) index.php
RewriteRule ^vb/(.*) index.php
RewriteRule ^packages/(.*) index.php
RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}
RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&{QUERY_STRING}
RewriteRule ^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING}
RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&{QUERY_STRING}
RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}


Thanks.


Top
   
 Post subject:
PostPosted: Tue Feb 15, 2011 9:32 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Apache's Rewrite configuration is not directly compatible with other web servers. You'll have to translate the rules into something nginx can understand, either line-for-line using rewrite or by figuring out what the rules are trying to do and writing an nginx configuration to do it with minimal rewriting. Both are formidable tasks, and I would consider being Apache-specific to be a vBulletin bug.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Tue Feb 15, 2011 6:24 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
Found this over at vbulletin.com

Code:
rewrite ^/threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /showthread.php?t=$1&page=$2;
rewrite ^/members/([0-9]+) /member.php?u=$1;
rewrite ^/forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /forumdisplay.php?f=$1&page=$2;
rewrite ^/blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /blog.php?u=$1&page=$2;
rewrite ^/entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /entry.php?b=$1&page=$2;
rewrite ^/list/([^/]*/)([0-9]+) /list.php?r=$1$2;
rewrite ^/content/(.*) /content.php?r=$1;


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group