Posts Tagged bonfire

Getting CodeIgniter/Bonfire running on nginx

So… I’ve been trying CI/Bonfire as a quick PHP dev platform. Unfortunately, it’s pre-packaged for Apache’s .htaccess, so it takes a bit of configuration to get working on nginx. The following assumes PHP-FPM is actually working though.

 Installing CI/Bonfire

For some reason, the install portion has its own index.php. So the default PHP pretty URL rewriting fails – or in this case, causes infinite redirects.

The trick was to add an extra location to nginx’s config file:

# Installing Bonfire/CI requires this - install has its own index.php
     location /install/ {
       try_files $uri $uri/ /install/index.php;
     }

Once the install is done, we can swap it out for URL rewriting:

# URL rewriting generally requires this, PHP specific
location / {
    try_files $uri $uri/ /index.php;
    allow all;
}

There was one extra thing necessary to do: change in the index_page variable in  bonfire/application/config/config.php. This was probably a result of my testing to try and get things working, but I had “index.php” in it, so all the generated pages had index.php/ prepended to the internal links.

Hat tip to http://ericlbarnes.com/posts/codeigniter-nginx-virtual-host/ for a good starting point

, , , ,

No Comments