I’m trying to move my vbulletin forum to nginx+fastcgi php. The
traffic is killing apache2. The only thing left is rewrite rule for
vbseo. I’ve been trying to convert them myself, but I have to give up
and ask for your help. These are the rules:
RewriteRule ^((urllist|sitemap_).*.(xml|txt)(.gz)?)$ vbseo_sitemap/
vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
RewriteRule ^(..php(/.)?)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|
images)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
Any help will be very appreciated. I will include the working code on
Wiki for other users…
Thanks
Jan
I would start with something like this:
location ~*
^.+.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root /home/vbseo/public_html;
rewrite
^/archive/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$
/vbseo.php?vbseourl=$1 last;
expires 10d;
break;
}
location / {
root /home/vbseo/public_html;
index index.php;
if (!-e $request_filename) {
rewrite ^(.+)$ /vbseo.php?vbseourl=$1 last;
}
Thanks for all the tips. For a combination of Typo3 installation on
root (realurl rewriting to /index.php) and vbseo enhanced vbulletin
in /forum/ directory of a main site I’ve come up with the following:
server {
listen 192.168.1.1:80;
server_name www.servername.tld;
access_log /var/log/nginx/www.servername.tld.access.log combined;
root /var/www/hosts/www.servername.tld;
index index.php index.html index.htm;
location ~ /.ht {
deny all;
}
location /forum/ {
rewrite ^/forum/((urllist|sitemap_)..(xml|txt)(.gz)?)$ /forum/
vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
if ($request_filename ~ “.php$” ) {
rewrite ^(.)$ /forum/vbseo.php?vbseourl=$1 last;
}
if (!-e $request_filename) {
rewrite ^/forum/(.)$ /forum/vbseo.php?vbseourl=$1 last;
}
}
location / {
if (!-e $request_filename) {
rewrite ^(.)$ /index.php last;
}
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/hosts/www.servername.tld
$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
}
Does it make sense? Can it be better? Anything I should be aware of?
Thank you
Jan
I am attempting to use vBSEO with nginx as well. Your rules work great
except image attachments currently aren’t working. I believe vBSEO
rewrites attachment URLs in Apache as well, but there aren’t any
applicable nginx rewrites active in the conf you posted.
Do you have any idea what might get them working (are they working for
you)?
Jan Åšlusarczyk wrote:
root /var/www/hosts/www.servername.tld;
}
fastcgi_pass 127.0.0.1:9000;
–
Andrew Hunn (Boethius)
[email protected]