Welcome! Log In Create A New Profile

Advanced

Migration from Apache, need advice on rewrite rules.

Posted by dab 
dab
Migration from Apache, need advice on rewrite rules.
May 08, 2009 08:37PM
Want to use SilverStripe with nginx, but im not experienced with apache rewrite rules, so please advice how change them for nginx:
[code]
RewriteBase /

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
[/code]
Re: Migration from Apache, need advice on rewrite rules.
May 10, 2009 03:04PM
[code]
if ($uri ~ "^(.*)$"){
set $rule_0 2$rule_0;
}
if (!-f $request_filename){
set $rule_0 3$rule_0;
set $bref_1 $1;
}
if ($rule_0 = "321"){
rewrite /.* /sapphire/main.php?url=$bref_1&$args last;
}

[/code]

Webmaster of www.Pic-City.de
dab
Re: Migration from Apache, need advice on rewrite rules.
May 11, 2009 06:26AM
Thank you TommyGFX,
i add this rules to location section of my nginx.conf, but it not work.
Please check my config. I set up SilverStripe to ss231 directory, so path is /usr/local/nginx/html/ss231 and URL http://localhost/ss231

[code]
user www-data;
worker_processes 5;

events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;

server {
listen 80;
server_name localhost;

location / {
root html;
index index.php index.html index.htm;
}

location /ss231/ {
root /usr/local/nginx/html/ss231;
index index.php;
if ($uri ~ "^(.*)$"){
set $rule_0 2$rule_0;
}
if (!-f $request_filename){
set $rule_0 3$rule_0;
set $bref_1 $1;
}
if ($rule_0 = "321"){
rewrite /.* /sapphire/main.php?url=$bref_1&$args last;
}
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
}
}
}


[/code]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready