ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

[HowTo] Nginx and CP on Windows

Added by Chili Fan at 2012-08-02 12:53 pm

Hello as adviced for bigger files downloads is Nginx rather better then Running Thin

Currently i run Thin succesfull at localhost 127.0.0.1 and port 3000 and ChiliProject is running then at http://localhost:3000/chiliproject/

Now i would like to give Nginx a try
http://www.nginx.com
Next i get the Win32 release package at
http://wiki.nginx.org/Install


At the wiki of Nginx there is this tutorial (which seems easier only nginx.conf adjustment)
http://wiki.nginx.org/Redmine


but at ChiliProject there is this tutorial which i would like to try first
https://www.chiliproject.org/projects/chiliproject/wiki/HowTo_configure_Nginx_to_run_ChiliProject

Basically it Point to create a new file proxy.include located at nginx root folder by
http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine

and replace contents of file nginx.conf by
http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine
and
https://www.chiliproject.org/projects/chiliproject/wiki/HowTo_configure_Nginx_to_run_ChiliProject

Anybody can help to get this configured at localhost 127.0.0.1 and running at sub folder http://localhost:3000/chiliproject/

Thanks in advance

proxy.include

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

client_max_body_size    10m;
client_body_buffer_size 128k;

proxy_connect_timeout 90;
proxy_send_timeout    90;
proxy_read_timeout    90;

proxy_buffer_size          4k;
proxy_buffers              4 32k;
proxy_busy_buffers_size    64k;
proxy_temp_file_write_size 64k;

nginx.conf
# Upstream Ruby process cluster for load balancing
upstream thin_cluster {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
    server 127.0.0.1:8003;
}

server {
    listen       your.ip.address.here:80;
    server_name  your.domain.name;

    access_log  /var/log/nginx/redmine-proxy-access;
    error_log   /var/log/nginx/redmine-proxy-error;

    include sites/proxy.include;
    root /var/lib/redmine/redmine/public;
    proxy_redirect off;

    # Send sensitive stuff via https
    rewrite ^/login(.*) https://your.domain.here$request_uri permanent;
    rewrite ^/my/account(.*) https://your.domain.here$request_uri permanent;
    rewrite ^/my/password(.*) https://your.domain.here$request_uri permanent;
    rewrite ^/admin(.*) https://your.domain.here$request_uri permanent;

    location / {
        try_files $uri/index.html $uri.html $uri @cluster;
    }

    location @cluster {
        proxy_pass http://thin_cluster;
    }
}

server {
    listen       your.ip.address.here:443;
    server_name  your.domain.here;

    access_log  /var/log/nginx/redmine-ssl-proxy-access;
    error_log   /var/log/nginx/redmine-ssl-proxy-error;

    ssl on;

    ssl_certificate /etc/ssl/startssl/your.domain.here.pem.full;
    ssl_certificate_key /etc/ssl/startssl/your.domain.here.key;

    include sites/proxy.include;
    proxy_redirect off;
    root /var/lib/redmine/redmine/public;

    # When we're back to non-sensitive things, send back to http
    rewrite ^/$ http://dev.ufsoft.org$request_uri permanent;

    # We need to test if it's not a sensitive URL and if it's a GET method
    # since we should only redirect GET methods back to http!!!
    set $redirect_test "";
    if ( $request_method = GET ) {
        # This is a GET method, redirection can occurr
        set $redirect_test "G";
    }

    # Examples of URLs we don't want to rewrite (otherwise 404 errors occur):
    # /projects/PROJECTNAME/archive?status=
    # /projects/copy/PROJECTNAME
    # /projects/PROJECTNAME/destroy

    # This should exclude those (tested here: http://www.regextester.com/ )
    if ( $uri !~* "^/projects/.*(copy|destroy|archive)" ) {
        # This is not a sensisive url, redirection can occur
        set $redirect_test "${redirect_test}R";
    }
    if ($redirect_test = GR) {
        # Both tests above match, redirection can ocurr
        rewrite ^/projects(.*) http://dev.ufsoft.org$request_uri permanent;
    }

    rewrite ^/guide(.*) http://your.domain.here$request_uri permanent;
    rewrite ^/users(.*) http://your.domain.here$request_uri permanent;
    rewrite ^/my/page(.*) http://your.domain.here$request_uri permanent;
    rewrite ^/logout(.*) http://your.domain.here$request_uri permanent;

    location / {
        try_files $uri/index.html $uri.html $uri @cluster;
    }

    location @cluster {
        proxy_pass http://thin_cluster;
    }
}


Replies (2)

RE: [HowTo] Nginx and CP on Windows - Added by Kris Lou at 2012-08-02 10:09 pm

This looks like it involves running Nginx as a reverse proxy to a Thin cluster running in the background. I don't have any experience with Nginx, but do something similar with Cherokee.

In order to use this nginx.conf, you will need to first set up Thin to respond to ports 8000-8003 (see the upstream thin_cluster part). Then Nginx will serve content on port 80/443 and you can adjust as necessary.

Good luck.

RE: [HowTo] Nginx and CP on Windows - Added by Chili Fan at 2012-08-03 12:42 pm

This looks like it involves running Nginx as a reverse proxy to a Thin cluster running in the background
I don't have any experience with Nginx, but do something similar with Cherokee.

Nice to know it is like "running Nginx as a reverse proxy..." (i have no experience and looked at the example(s) arround here) http://www.cherokee-project.com/ (keep this one in mind)

In order to use this nginx.conf, you will need to first set up Thin to respond to ports 8000-8003 (see the upstream thin_cluster part).

Thanks very helpfull something like this starting four Instances of Thin(s) at the Port(s) configured by "thin_cluster"
https://www.chiliproject.org/boards/1/topics/1420?r=1971#message-1971
root:\rootchili\ruby\bin\ruby" -S bundle exec thin -p 8000 -e production -A rails --prefix /chiliproject start
root:\rootchili\ruby\bin\ruby" -S bundle exec thin -p 8001 -e production -A rails --prefix /chiliproject start
root:\rootchili\ruby\bin\ruby" -S bundle exec thin -p 8002 -e production -A rails --prefix /chiliproject start
root:\rootchili\ruby\bin\ruby" -S bundle exec thin -p 8003 -e production -A rails --prefix /chiliproject start

ChiliProject_Port8000-Thin
ChiliProject_Port8001-Thin
ChiliProject_Port8002-Thin
ChiliProject_Port8003-Thin

Then Nginx will serve content on port 80/443 and you can adjust as necessary.

okay i see "80/443" is configured at nginx.conf good to know, i try futher adjustments of nginx.conf to make it run

(1-2/2)