Contents |
Gallery3:Using NGINX documents part of Gallery3 which is in development.
Gallery3 is unstable and not suitable for production.
Features that are present may change or be removed.
Features that are absent may be planned or not.
If you want to participate, join the discussion!
Gallery3:Using NGINX documents part of Gallery3 which is not supported in the core distribution.
If you want to participate, join the discussion!
The core team only supports Gallery3 running on Apache 2.
For anyone who wants to use NGINX, we will attempt to place info on config and other details here.
This config will allow the kohana index.php dispatcher to work properly:
location /path/to/gallery3 {
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/path/to/gallery3/index.php/(.+)$ /path/to/gallery3/index.php?kohana_uri=$1 last;
}
}
Modified based on http://forum.kohanaphp.com/comments.php?DiscussionID=1723&Focus=12240
I didn't have to add the rewrites above. I think setting PATH_INFO is enough:
http {
upstream php {
server 127.0.0.1:9000;
}
}
server {
...
location /gallery {
root /path/to/gallery;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
To remove index.php from short URLs, change the rewrite line in the NGINX configuration stanza above as follows:
rewrite ^/path/to/gallery3/(.+)$ /path/to/gallery3/index.php?kohana_uri=$1 last;
Also, change the definition of $config['index_page'] in /application/config/config.php to:
$config["index_page"] = "";
Note: See http://gallery.menalto.com/node/91840 for discussion. This solution appears to work but has not been exhaustively tested.
The main directory contains the following:
php_flag short_open_tag 1 php_flag register_globals 0 php_value upload_max_filesize 20M php_value post_max_size 100M
Make sure these are added to your php.ini file. Note that the first option, short_open_tag, conflicts with the recommended configuration (although short_open_tag is the default in almost all environments)
Obviously, I don't expect that a dynamic update to .htaccess will take effect (and my understanding is that the image firewall will somehow be based on .htaccess, instead of the current php wrapper), and I'm not sure how I'll handle it; I suppose I'll have to see exactly what is implemented, but for as long as possible, I plan to try and see what can be done to use G3 with NGINX.
This patch file (attempts) to add support for permissions in NGINX (I assume it would be quite useful in porting G3 to lighttpd as well). Right now it's on my site [1]. In order to use it, apply this patch to the G3 source tree (it was based on r19576, the latest at the time). Modify core/helpers/access.php to point to a suitable location (almost definitely NOT /var/www/testing/gallery3/nginx.htaccess), and add this to your nginx.conf file:
include "/filesystem/path/to/nginx.htaccess";
There are a few TBDs here:
Please send me feedback, or post to the devel list.
Add the following line to your NGINX configuration, just after "if (-f $request_filename) {":
rewrite ^/gallery3/var/albums/(.*)$ /gallery3/file_proxy/$1 last;
This directs all requests for full-size images to file_proxy. Gallery3 will throw up an error when you restrict access to full-size images in the album permission dialog box, but it does appear to function correctly. Please report any bugs.