I am converting to nginx from apache. The application in question is as follows
/contentlibrary_js /contentlibrary_js/app/index.php --> one page ajax app /contentlibrary_js/pagecreator/index.php --> codeigniter application backend
I'm hoping to have one server block handle both the request to the frontend and the requests to the backend.
With the following configuration, I recieve "rewrite or internal redirection cycle while internally redirecting to "/index.php" in my nginx error log.
I tried adding a second location block to handle requests to the pagecreator/index.php file but I then the application hangs waiting for a response and I get "FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream," in the error log.
Any suggestions, Thanks
server { server_name contentlib.dev; #access_log logs/leonardo.access.log main; root /Users/acasanova/projects/mednet/contentlibrary_js; index index.html index.htm index.php; try_files $uri $uri/ /pagecreator/index.php /index.php /index.php$uri /index.php?$args; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # Codeigniter # location /pagecreator/{ # try_files $uri $uri/ index.php$request_uri; # #root /Users/acasanova/projects/mednet/contentlibrary_js/pagecreator; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /Users/acasanova/projects/mednet/contentlibrary_js/pagecreator$fastcgi_script_name; # include fastcgi_params; # } location ~ [^/]\.php(/|$) { #GC # try_files $uri $uri/ /index.php$uri /index.php?$args; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; } location ~ /\.ht { deny all; } }
try_filesblock is quite odd. What is the thing you are trying to achieve with th eline? In practice it always goes topagecreator/index.php, if there is no such file or directory as specified in the URI.