/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>&nbsp;(in the \"Also Good Section\")<\/em><\/p>"}}
comments powered by Disqus
 

Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

 
This page is best viewed with Firefox 3.5+, Chrome 5+, Safari 5+, Opera 10.6+, IE 9+
Copyright © 2014 8bitrobot.com