Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So essentially I'm currently facing a problem with getting the following to work.

http://example.net/url.php/value1/value2/value3

I've tried various methods of try_files, but none of them seem to be working. The above is literally all I need to be able to do, but this is the error that I'm coming up with:

Here is a copy of my current config.

            server {
                listen          80;
                server_name     example;
                error_log       /var/log/nginx/error.log;

                index           index.php;
                root            /www/example.net;

                location / {
                    try_files $uri $uri/ /index.php =404;
                }

                location ~* \.php$ {
                    include fastcgi_params;
                    fastcgi_pass 127.0.0.1:9000;
                }
            }

I've tried a lot of combinations I've read from various tutorials for the try_files in location / and none of them have worked in the way that I've wanted. I've either got a 404 (if index.php isn't included in the end, because it's not finding the file or a directory) or a 500 error.

2013/01/23 07:21:35 [error] 1411#0: *1 rewrite or internal redirection cycle while internally redirecting to "/testing_nginx.php/test", client: 75.182.96.115, server: subeta, request: "GET /testing_nginx.php/test HTTP/1.1", host: "166.78.101.192"
share|improve this question
    
Why do you want url.php in your URLs to begin with? Using it is a kludge for crappy web servers that don't have rewrites and things like try_files. Remove it. –  Michael Hampton Jan 23 '13 at 7:47

1 Answer 1

You can use Nginx URL Rewriting. By instance can add this to your nginx.conf.

location / {
  rewrite  ^/pay/(.*)/(.*)$     /pay.php?p=$1&s=$2?   last;
  rewrite  ^/register$          /register.php?        last;

  location ~ \.ph[pb]$ {
    #PHP FASTCGI SETTINGS
  }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.