Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jan 25, 2012 11:07 pm 
Offline

Joined: Wed Jan 25, 2012 11:02 pm
Posts: 1
Website: http://soundforums.net
I'm currently using the following nginx rewrite rules for my CMS, Blog, and Forums, which I've found posted in these forums: (Currently, while we're getting this set up, we're working on linode. davidkarol. com, and plan to move over this Friday)

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;


I can't load actual threads, posts, and blogs. After making some changes, I'm able to load the members list, along with the list of threads (each forum.) Here's my config file for the virtual host, and then that for nginx itself (slightly modified):
Code:
server {
    listen   80;
    server_name example.com;
    access_log /home/sfn/www/example.net/logs/access.log;
    error_log /home/sfn/www/example.net/logs/error.log;
        root   /home/sfn/www/example.net/public_html/;

    location / {
        index index.php  index.html index.htm;
        rewrite ^/live/threads/([0-9]+)  /showthread.php?t=$1&page=$2;
        rewrite ^/live/members/([0-9]+) /member.php?u=$1;
#       rewrite ^/live/forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /forumdisplay.php?$
        rewrite ^/live/forums/([0-9]+) /forumdisplay.php?f=$1;
        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=$$
        rewrite ^/list/([^/]*/)([0-9]+) /list.php?r=$1$2;
        rewrite ^/content/(.*) /content.php?r=$1;
   }


   }


    # Pass PHP scripts on to PHP-FPM
    location ~* \.php$ {
        try_files       $uri /index.php;
        fastcgi_index   index.php;
        fastcgi_pass    127.0.0.1:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}


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


events {
        worker_connections 768;
        # multi_accept on;
}


http {


        ##
        # Basic Settings
        ##


        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;


        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;


        include /etc/nginx/mime.types;
        default_type application/octet-stream;


        ##
        # Logging Settings
        ##


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


        ##
        # Gzip Settings
        ##


        gzip on;
        gzip_disable "msie6";
        gzip_disable "msie6";


        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml applicati$


        ##
        # If HTTPS, then set a variable so it can be passed along.
        ##


        map $scheme $server_https {
                default off;
                https on;
        }


        ##
        # Virtual Host Configs
        ##


        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


In addition, the rules being used on the old Apache server in each directory are below:

Here is the rewriting section I was using on Apache from first the root folder, than the forum and blog stub directories:

Root:
Code:
RewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d


RewriteRule ^.*$ - [NC,L]


# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
RewriteRule ^entries/.* entry.php [QSA]


RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d


RewriteRule ^.*$ - [NC,L]


# MVC
RewriteCond %{REQUEST_FILENAME} !\.php$
RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]


Forum (/live)
Code:
RewriteCond %{REQUEST_FILENAME} -f [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d


RewriteRule ^.*$ - [NC,L]


# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]




Blog (/blog)
Code:
RewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d


RewriteRule ^.*$ - [NC,L]


RewriteRule ^blogs/.* blog.php [QSA]
RewriteRule ^entries/.* entry.php [QSA]





Any ideas?

Thanks,

dk


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


Who is online

Users browsing this forum: No registered users and 2 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