#1 March 2, 2015 4:35am

rebeccawand
Member
From: London
Registered: February 24, 2015
Posts: 2

BigTree and Nginx Configuration

Hi all,

Spent a while playing around trying to get BigTree to play nice on Nginx having had searches come up blank, and have just registered to share my results on here for anyone else who they may be of use to...

Nginx Server Block wrote:
server {
        server_name [domain] www.[domain];
        listen 80;
        root [path to web root]/site;
        index index.php index.html index.htm;
        sendfile off;

        location / {
                try_files $uri $uri/  @rewrite;
        }
        location @rewrite {
                rewrite ^/(.*)$ /index.php?bigtree_htaccess_url=$1;
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass [socket path];
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

Notably the try_files order and "sendfile off;" were particularly important in ensuring things worked correctly.

This then requires routing to be set as "htaccess" in /custom/environment.php like so:

/custom/environment.php wrote:
$bigtree["config"]["routing"] = "htaccess";

Got one BigTree site running very happily on Nginx 1.4.6, with another in the pipework!

Feel free to use this config for your own purposes and for documentation should you wish. Keep up the great work! smile

-Rebecca

Offline

#2 March 2, 2015 11:11am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: BigTree and Nginx Configuration

That's excellent! Thank you for sharing -- I'll try to get this integrated into the documentation (and maybe the 4.2 installer). I'd meant to look into nginx support but got sidetracked a while back and forgot about it. Congrats on the site launch, hope the next one goes smoothly! If you have any questions feel free to post here or drop me an email smile

Offline

#3 March 2, 2015 4:08pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: BigTree and Nginx Configuration

I setup a Vagrant environment and tested out your config but was having issues with it parsing PHP until I added something from the default PuPHPet config:

fastcgi_param SCRIPT_FILENAME $request_filename;

Prior to the "include fastcgi_params" line.

It's entirely possible this is due to my Vagrant setup -- looks like the default in fastcgi_params is:

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

The nginx docs say it should be $document_root$fastcgi_script_name by default, so it's probably my silly Vagrant setup that has the defaults wrong.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.