/2012/06/30/Nginx--Have-static-and-PHP-files-play-nice-together/
{"item":{"status":"visible","url":"\/2012\/06\/30\/Nginx--Have-static-and-PHP-files-play-nice-together\/","trash":"","name":"Nginx--Have-static-and-PHP-files-play-nice-together","parent":"","title":"Nginx: Have static and PHP files play nice together","date":"2012-06-30 17:00:00","filepath":"posts\/20120630_Nginx--Have-static-and-PHP-files-play-nice-together.xml.json","type":"post","content":"<p><img style=\"float: left; margin-left: 10px; margin-right: 10px;\" src=\"http:\/\/www.8bitrobot.com\/media\/uploads\/2012\/01\/information.png\" alt=\"\" width=\"72\" \/>While trying to configure <a href=\"http:\/\/nginx.org\/\">Nginx<\/a> and PHP so that the PHP files would run from the same directory as static files, the error \"<em>290 rewrite or internal redirection cycle while internally redirecting to \"\/index.php\"...<\/em>\" persistently recurred.<\/p>\n<p>Everything worked fine after changing nginx.conf to the following (inside <em>server {<\/em>):<\/p>\n<pre style=\"padding-left: 30px; clear: both;\">root html;\nindex index.php index.html index.htm;\nlocation \/ {\n try_files $uri $uri\/ \/index.php?$args;\n}\nlocation ~ \\.php$ {\n include fastcgi_params;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n fastcgi_pass 127.0.0.1:9123;\n}<\/pre>\n<p><em><a href=\"http:\/\/wiki.nginx.org\/Pitfalls#Proxy_Everything\">Source<\/a> (in the \"Also Good Section\")<\/em><\/p>"}}