MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: milad_a on 2013-05-06, 16:34:12

Title: nginx rewrite rules!
Post by: milad_a on 2013-05-06, 16:34:12
hi

i try to swith my web server to nginx from apache , i have VBulletin forums , after some code changing i can open my first page forum! but i have VBSEO and it need some rewrite URLs i try to put it in nginx.conf , on *.domain.tpl and others but all codes back me to first page of forum! i get this code for nginx from VBSEO official forum :

Quote
location /forums/ {
rewrite ^/forums/((urllist|sitemap_).*.(xml|txt)(.gz)?)$ /forums/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

try_files $uri $uri/ /forums/vbseo.php?$args;
}

location ~ /forums/(.*.php)$ {
rewrite ^/forums/(.*)$ /forums/vbseo.php last;
}
location /forums/vbseo/(includes|resources/html|resources/xml)/ {
    allow      127.0.0.1;
    deny      all;
}

replace /forum/ to my forum folder path but nginx give error that "location" or "server" is not a recognized command! try to use rewrite lines only like:

rewrite ^/forums/(.*)$ /forums/vbseo.php last;

again no success! can any body give me working rewrite url for nginx from above codes?

in addition when i try /script/fixweb , all added code will be remove! and i must insert again!
Title: Re: nginx rewrite rules!
Post by: MRatWork on 2013-05-06, 16:38:50
Copy /home/nginx/tpl/domains.conf.tpl to /home/nginx/tpl/custom.domains.conf.tpl  and then modified this custom file with php code (because tpl using 'inline-php').

After that, run 'sh /script/fixweb; sh /script/restart-services'.