Welcome! Log In Create A New Profile

Advanced

Rewrite problem http://x.x.x.x/folder_name/index.php/css/first.css

November 07, 2011 08:43AM
Hello,
I made test against lighttpd and ngninx is 50% faster...

So I tried to use it with my already made application. (postgres & php).
After setting evrything I found the URL to be a problem.

Apache and lighttpd can use URL http://x.x.x.x/folder_name/index.php/css/first.css as http://x.x.x.x/folder_name/index.php with REQUEST_URI part = "/css/first.css" - this is handle by PHP and processed along...

Nginx is trying to open index.php as folder an of course 404 is thrown...

I was trying to rewrite this URL but no success

my /etc/nginx/sites-available/default
[code]
...
server {
listen 80;
# listen 443 ssl;
server_name jakasnazwa.localhost;

ssl off;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;

root /home/main-www;
index index.php index.htm index.html;

error_log /var/log/nginx/website.error_log notice;
#rewrite_log on;

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/main-www$fastcgi_script_name;
include fastcgi_params;
}

location / {
autoindex on;
if (-f $request_filename) {
break;
}

if (!-e $request_filename) {
rewrite ^(.*)/index.php/(.+)$ $1/index.php/$2 last;
break;
}
}
}
[/code]

Of course rewrite don't change anything (cut and paste, part of url in the same place) but I have no idea how to force nginx to fire php-fpm na index.php file passing everything what is after this as parameter?

Can you point me to some clues or solution?

PS I know that URL should look different, but application is ready, I don't want to change it in this moment .

Regards
Mikolaj
Subject Author Posted

Rewrite problem http://x.x.x.x/folder_name/index.php/css/first.css

mikolajj November 07, 2011 08:43AM

Re: Rewrite problem http://x.x.x.x/folder_name/index.php/css/first.css

Francis Daly November 07, 2011 02:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 310
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