Social Engine 4 + NGinX - Rewrite rules
November 17, 2010 08:42AM
Hi folks,
I've got my social engine 4 running on Nginx server.
So far I'm having problems getting the rewrite rules to work.
I'm posting the original .HTAccess rewrite rules from apache .
Could some one please help me convert this to nginx rules , PLEASE ?
.... I'm desperate to get this working.
Thanks in advance.

Here's the .htaccess file.

[quote]<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

# Get rid of index.php
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]

# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]

# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]

# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]

</IfModule>

# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On

# @todo This may not be effective in some cases
FileETag Size[/quote]
Re: Social Engine 4 + NGinX - Rewrite rules
November 19, 2010 05:30AM
I've got the set up working. BUT everytime I try to access the /install directory there appears to be a loop in Nginx .

I'm pasting my current config .
Does anyone have a suggestion/solution ?
Thanks


[quote]server {
listen 80;
server_name MyDomain.net www.MyDomain.net;

error_log /home/MyDomain/nginx/logs/MyDomain.net.error.log;
access_log /home/MyDomain/nginx/logs/MyDomain.net.access.log;
root /home/MyDomain/MyDomain.net;
index index.php index.html;
fastcgi_index index.php;

######################### general rewrite ###################################

# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|htm)$ {
access_log off;
expires 30d;
}

location / {
try_files $uri $uri/ @se;
}
location @se {

root /home/MyDomain/MyDomain.net;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(/)(/.*)$;
fastcgi_param SCRIPT_FILENAME /home/MyDomain/MyDomain.net$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}

location ~ ^/(.+)_(.+)/(.+)/$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/MyDomain/MyDomain.net$fastcgi_script_name;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param PATH_INFO /action1/$1/action2/$2/action3/$3;
}

location ~ index\.php {
root /home/MyDomain/MyDomain.net;
rewrite .* /index.php?rewrite=1 break;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/MyDomain/MyDomain.net$fastcgi_script_name;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/MyDomain/MyDomain.net;
fastcgi_pass_request_body off;
client_body_in_file_only clean;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
}




location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/MyDomain/MyDomain.net$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/MyDomain/MyDomain.net;

fastcgi_pass_request_body off;
client_body_in_file_only clean;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
}

location /install/ {
root /home/MyDomain/MyDomain.net/install;
index index.php;
if (!-e $request_filename) { rewrite ^(.*)$ /install/index.php?rewrite=1; }
}

if (!-e $request_filename) { rewrite ^(.*)$ /index.php?rewrite=1; }

}[/quote]
Re: Social Engine 4 + NGinX - Rewrite rules
February 14, 2014 08:55AM
Hi Folks,

I am facing the same issue. Can anyone help out with an solution please
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 110
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready