Thank you. Your setup is fastcgi, not scgi, correct?

I'm now unclear about the scgi setup. From the wiki I thought scgi requires
just two pieces. First, start fossil like

    fossil --localhost --scgi /srv/fossils/partner

and second, set an nginx location similar to

    location ~ ^/partner/ {
        include scgi_params;
        scgi_pass 127.0.0.1:8080;
        scgi_param SCRIPT_NAME "/partner";
    }

A stub cgi script is not needed.

I'll tinker with scgi tomorrow, but even if I get it working, I don't yet
see how scgi ensures fossil generates correct links to it's gui while that
route back user url's similar to

    http://somewhere.mydomain.com/partner/<repo-name>/...

back to the fossil server listening to sgci protocol traffic
on127.0.0.1:8080. With scgi I think I still need to configure nginx
`location` trickery to handle uri and :80 to 127.0.0.1:8080 issues.

Feels like I'm missing a piece of the puzzle and overcomplicating nginx +
fossil.


On Tue, Mar 4, 2014 at 4:15 PM, Stephen Cripps <[email protected]> wrote:

>  Hi Jon,
>
> I went through the process of setting up fossil behind NGINX the same way
> your looking for, where you can specify the repository depending on the
> url. At first I tried the proxy method with xinetd, but had to play with
> path's of the actual repositories before it would work.
>
> The solution I went with was to use scgi with configuration similar to the
> following:
>
> In /etc/nginx.conf
>
>         location ~ ^/fossil(.*)$ {
>             fastcgi_pass    unix:/run/fcgiwrap.sock;
>             include         fossil_fcgi_params;
>             fastcgi_param   SCRIPT_NAME "/fossil";
>         }
>
> In fossil_fcgi_params
>
> fastcgi_param  QUERY_STRING       $query_string;
> fastcgi_param  REQUEST_METHOD     $request_method;
> fastcgi_param  CONTENT_TYPE       $content_type;
> fastcgi_param  CONTENT_LENGTH     $content_length;
> fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
> fastcgi_param  REQUEST_URI        $request_uri;
> fastcgi_param  DOCUMENT_URI       $document_uri;
> fastcgi_param  DOCUMENT_ROOT      $document_root;
> fastcgi_param  SERVER_PROTOCOL    $server_protocol;
> fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
> fastcgi_param  SERVER_SOFTWARE    nginx;
> fastcgi_param  REMOTE_ADDR        $remote_addr;
> fastcgi_param  REMOTE_PORT        $remote_port;
> fastcgi_param  SERVER_ADDR        $server_addr;
> fastcgi_param  SERVER_PORT        $server_port;
> fastcgi_param  SERVER_NAME        $server_name;
> fastcgi_param  REMOTE_USER        $remote_user;
>
> And the cgi script as
>
> #!/usr/bin/fossil
> directory: /srv/fossil/
> notfound: http://localhost/invalid.html
>
> Where /srv/fossil is where I keep the .fossil files.
>
> Stephen C
>
>
> On 04/03/14 01:34 PM, Jon wrote:
>
>  New to fossil and am trying to stand up a simple fossil server fronted
> by nginx. I've read the website doco, spelunked the mailing list, and have
> tweaked configurations a bit. All to no avail.
>
>  I want to use fossil and nginx to make multiple repos available via base
> url's such as
>
>    http://somewhere.mydomain.com/partner/<repo-name>
>
>  in which fossil repos live under root-owned /srv/fossils/partner as
> *.fossil files
>
> With limited nginx configuration tweaking the best I've been able to
> achieve is a fossil repo main page but with invalid links (e.g. -
> http://127.0.0.1:8080/logicalmaps/index) pointing to the fossil server
> running in localhost mode. Via the following I see fossil redirects which
> likely means a more complex nginx config.
>
> $ curl -I http://stimpy/partner/logicalmaps
> HTTP/1.1 302 Moved Temporarily
> Server: nginx
> Date: Tue, 04 Mar 2014 18:03:09 GMT
> Content-Type: text/html; charset=utf-8
> Content-Length: 80
> Connection: keep-alive
> Location: http://stimpy/logicalmaps/index
> X-Frame-Options: SAMEORIGIN
> Cache-control: no-cache
>
>  Below are the relevant snippets of my original fossil and nginx config
> that does not work.
>
> Before I spend more time (likely in the wrong direction) I'd appreciate
> your guidance as to the best way to setup fossil + nginx. I'd prefer nginx
> in reverse http proxy mode but SCGI is also fine. Once the base config
> works, I'll move to HTTPS.
>
>  Jon
>
>
>
>  ==== BASIC FOSSIL and NGINX CONFIGURATION ====
>
>  # upstart script - /etc/init/fossil.conf
>  description "Fossil DVCS Server"
>
> start on runlevel [2345]
> stop on runlevel [!2345]
> respawn
>
> exec /usr/local/sbin/fossil server --localhost /srv/fossils/partner
>
>
>  # main nginx config - /etc/nginx/nginx.conf
> ...
> http {
>     include       /etc/nginx/mime.types;
>     default_type  application/octet-stream;
>     ...
>     include /etc/nginx/conf.d/*.conf;
> }
>
>
>  # default nginx config - /etc/nginx/conf.d/default.conf
>  server {
>     listen       80 default_server;
>     server_name  stimpy;
>     server_tokens off;
>     ...
>     location / {
>         root   /usr/share/nginx/html;
>         index  index.html index.htm;
>     }
>     ...
>      location /partner/ {
>          proxy_pass http://127.0.0.1:8080/;
>          proxy_connect_timeout 30s;
>          proxy_set_header Host $host;
>          proxy_set_header X-Real-IP $remote_addr;
>          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>     }
>     ...
>  }
>
>
> jon@stimpy:~$ ps aux | egrep 'nginx|fossil'
> root      2279  0.0  0.0   2584   372 ?        Ss   Feb26   0:00
> /usr/local/sbin/fossil server --localhost /srv/fossils/partner
> root     16849  0.0  0.2  31208  2652 ?        S    12:56   0:00 nginx:
> master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
> nginx    16850  0.0  0.1  31564  1656 ?        S    12:56   0:00 nginx:
> worker process
>
>
> _______________________________________________
> fossil-users mailing 
> [email protected]http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
>
>
> _______________________________________________
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
>
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to