DooPHP IRC channel


Nginx setup/routing help

Discussion about installation and environment issues.

Nginx setup/routing help

Postby weapons » Sun May 27, 2012 1:51 pm

I'm not able to find reliable documentation on how to setup doophp with Nginx. The snippets on the site aren't really working and would appreciate if anyone could give me pointers!

I'm running Ubuntu 12.04 and the nginx install is very basic, just for dev purposes. Nothing customized or anything like that.

The problem I'm having is that the URLs I visit in each declared section load up just fine on the index page, but the routing does not work at all. I can't really find any solid documentation as to what needs to be set, or where, so I have no idea what to change or what's wrong.

For the acl demo section, I can see the main page where it shows all the links and demo information, but any link I click on results in a 404.

The config portions I have declared are:

Code: Select all
   location ~ \.php$ {

      fastcgi_pass 127.0.0.1:9000;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;

   }

   location /doophp/app/ {
      index index.php;
      if (!-e $request_filename) {
         rewrite (.*) /doophp/app/index.php/$1;         
      }
   }

   location /doophp/demos/acl/ {
      index index.php;
      if (!-e $request_filename) {
         rewrite (.*) /doophp/demos/acl/index.php/$1;   
      }
   }


Any help would be greatly appreciated. Also, the documentation seems rather scattered, or few and far between. Is there a location/url with solid documetation or am I just not seeing it? Something like installation, setup, examples, etc.
weapons
 
Posts: 2
Joined: Sun May 27, 2012 1:43 pm

Re: Nginx setup/routing help

Postby weapons » Sun May 27, 2012 3:53 pm

I've narrowed it down to the rewrite rule.

The rule given on the site for nginx does not work as it causes "rewrite or internal redirection cycle" errors in the logs:


Code: Select all
2012/05/27 11:47:50 [error] 4326#0: *1 rewrite or internal redirection cycle while processing "/doophp/app/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/gen_site", client: 127.0.0.1, server: localhost, request: "GET /doophp/app/index.php/gen_site HTTP/1.1", host: "localhost", referrer: "http://localhost/doophp/app/index.php"


So I change the rewrite rule (quite randomly) to:

rewrite ^/doophp/app/(.+)$ /doophp/app/index.php?$1 last;

...and suddenly it works. Which is VASTLY different from the configuration examples given on the site. Did something change in nginx or are the examples just outdated?
weapons
 
Posts: 2
Joined: Sun May 27, 2012 1:43 pm


Return to Installation & Setup

Who is online

Users browsing this forum: No registered users and 1 guest