A while ago I decided to convert my server over from using Apache to using Nginx. Most things I host are fairly straightforward and ported over without issue. But my Gallery 3 installation was a different story.
The precursor for this setup is configuring PHP FastCGI for the Nginx server, which doesn’t happen automatically as it does with Apache. This isn’t as involved as it once was. Nginx offers a good resource.
Most of the work for involved in getting Gallery 3 working on Nginx involves the configuration file for the server block. My full configuration is embedded below. I’m sure I haven’t nailed it yet. (Much apprecation goes to this gist.)
The PHP configuration should match up with what you set up for PHP FastCGI above.
The section redirects any direct requests to your photos to a file proxy, keeping your Gallery 3 security settings active.
The Dirty Hack
The final step in getting Gallery 3 up and running, unfortunately, involves editing the Gallery 3 source in its installation location.
The file application/config/config.php needs to be edited to change the assignment of $config["index_page"] as follows:
This will need to be done at every update or reinstallation of the Gallery 3 application, so I route a sed command to do it for me.