Nginx redirect to index.php (solved?)

I’ve remove apache and installed nginx (following instructions on the documentation on this site)
all seems to be good and seem to have nginx running.

I’d like to redirect to the index.php file and pass ‘register’ in as the URL parameters (permalink style but not wordpress)

previous .htaccess looks like this (not that I fully understand this either ;o)

RewriteCond $1 !^(index.php|files|images|css|js)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

basically whatever the parameters are on th url they get passed into the index.php file

I think its to do with the location parameter in the nginx configuration. (I haven’t spotted or understood the information I’ve googled)

I’ll have a further look into it tomorrow to see how I get on
but any help appreciated in the meantime


I have permalink addresses (not wordpress) but my own variant. shoudl be the same.
here’s what I have and it works on the home page.:

            location ~ \.php(/|$) {
                    try_files $uri $fastcgi_script_name =404;
                    fastcgi_pass unix:/var/php-nginx/170406742736630.sock/socket;
	fastcgi_split_path_info ^(.+\.php)(/.+)$;

website is
when I go to a a showfixtures link
I get a 404 not found.

when I add the following line:
rewrite ^/(.*)$ /index.php/$request_uri;

the show fixtures link goes to homepage.

my next step was to try this, home page works, but link ‘showfixtures’ does not :

          location / {
                    try_files $uri /index.php?$request_uri;
                    fastcgi_pass unix:/var/php-nginx/170406742736630.sock/socket;

also when viewing an image it doesn’t work (though I see it does here as an embeded link).

I think this should be the line: try_files $uri /index.php?$args;

documentation hinted that rewrite (and not return) was all that was required.
here’s my current config, I have a number of folders, css, fonts,js that I want to allow through directly
then I wish to convert whatever is in the QUERY_STRING ($1) and feed it into the index.php file.
so far this seems the best solution so far to allow the site to work. can be optimised and made better but at least the website is functioning much as it was before (using apache)

rewrite ^/css/(.)$ /css/$1 break;
rewrite ^/fonts/(.
)$ /fonts/$1 break;
rewrite ^/js/(.)$ /js/$1 break;
rewrite ^/files/(.
)$ /files/$1 last;
rewrite ^/(.*)$ /index.php?$1 break;

location / {
try_files $uri /index.php?$args =404;
fastcgi_pass unix:/var/php-nginx/160406742727730.sock/socket;

well I should say I have some of it working.
I can’t get it to allow pages in a subfolder
and strangely a “load.gif” file is not showing from home page.

I will need to dig deeper
contact with F5/nginx themselves isn’t helpful

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.