http://www.perlmonks.org?node_id=924380

punkish has asked for the wisdom of the Perl Monks concerning the following question:

I installed Gitalist via cpanm against my Perlbrew Perl 5.14.1. I would like to run Gitalist so it appears as a sub-directory of my main web site, that is, at http://mywebsite.com/gitalist, however, none of the instructions in the module documentation seem to address this scenario.

Bumbling around, I can run it on http://127.0.0.1:some_port_num either via the bundled PSGI web server or via plackup, but then I can't access that web site from anything other than the localhost. On the other hand, I can use Apache's mod_proxy to access http://mywebsite.com/gitalist, and let apache proxy everything /gitalist to http://127.0.0.1:some_port_num. However, then the internal links in Gitalist are all broken. Gitalist generates the links for its images and css based on http://127.0.0.1:some_port_num, so they are all broken from http://mywebsite.com/gitalist.

I am unable to set up a VirtualHost on this web server. Suggestions?

Update: I did a terrible job explaining my problem above. So, here is another attempt, hopefully, clearer.

I have no problem running the Gitalist app. It works fine if I invoke it as a standalone server like so.

$ GITALIST_CONFIG=/path/to/gitalist.conf gitalist_server.pl

Now I view the web site at http://127.0.0.1:3000. I can do a similar thing with plackup, and even specify a different port. All is good. However, I want to access the site at http://mywebserver.edu./gitalist. So, I set up an apache config file for the gitalist website like so

ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /gitalist http://127.0.0.1:3000 ProxyPassReverse /gitalist http://127.0.0.1:3000

Then I started the built-in gitalist server like above

$ GITALIST_CONFIG=/path/to/gitalist.conf gitalist_server.pl

Now I can go to http://mywebserver.edu./gitalist and the gitalist web site appears, except, all the internal links still point to http://127.0.0.1:3000. As a result, none of the CSS or the images appear correctly. All these links should be pointing to http://mywebserver.edu./gitalist. So, http://127.0.0.1:3000/path/to/gitalist.css should be http://mywebserver.edu./gitalist/path/to/gitalist.css. I don't see any Gitalist config option that allows me to change these links. And, this can't be solved with mod_rewrite.

I hope my issue is clearer now.



when small people start casting long shadows, it is time to go to bed

Replies are listed 'Best First'.
Re: running Gitalist as a sub-directory of my main web site
by Corion (Patriarch) on Sep 06, 2011 at 13:24 UTC

    Gitalist is a Catalyst application. I'm not sure what problem you found running gitalist_cgi.pl on your webserver. Maybe if you can tell us what problems you encounter we can help you with getting gitalist_cgi.pl to run.

    If this is a question on how to configure Apache, you are in the wrong forum.

    Update: Added link to Apache documentation

      Obviously, I did a terrible job describing my problem. Let me retry --

      I have no problem running the app. It works fine if I invoke it as a standalone server like so.

      $ GITALIST_CONFIG=/path/to/gitalist.conf gitalist_server.pl

      Now I view the web site at http://127.0.0.1:3000. I can do a similar thing with plackup, and even specify a different port. All is good. However, I want to access the site at http://mywebserver.edu./gitalist. So, I set up an apache config file for the gitalist website like so

      ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /gitalist http://127.0.0.1:3000 ProxyPassReverse /gitalist http://127.0.0.1:3000

      Then I started the built-in gitalist server like above

      $ GITALIST_CONFIG=/path/to/gitalist.conf gitalist_server.pl

      Now I can go to http://mywebserver.edu./gitalist and the gitalist web site appears, except, all the internal links still point to http://127.0.0.1:3000. As a result, none of the CSS or the images appear correctly. All these links should be pointing to http://mywebserver.edu./gitalist. So, http://127.0.0.1:3000/path/to/gitalist.css should be http://mywebserver.edu./gitalist/path/to/gitalist.css. I don't see any Gitalist config option that allows me to change these links. And, this can't be solved with mod_rewrite.

      I hope my issue is clearer now. I will also update the original post with this information.



      when small people start casting long shadows, it is time to go to bed
Re: running Gitalist as a sub-directory of my main web site
by Your Mother (Archbishop) on Sep 06, 2011 at 13:41 UTC

    If you're running apache, adding this to your configuration will clear up the broken links-

        AllowEncodedSlashes On

    The other advice was good. It's a Catalyst application and there are many tutorials and guides, some in the Catalyst docs, for how to deploy them. Proxying is probably the best all around solution but fastcgi is probably the easiest. Here's a sample apache config for running one out of a user's home dir with local::lib.

    # Start gitalist with- # perl -Mlocal::lib=/home/moo/perl5 ~moo/Gitalist/script/gitalist_fa +stcgi.pl -l /tmp/gitalist.socket -d FastCgiExternalServer /tmp/gitalist.fcgi -socket /tmp/gitalist.socke +t Alias /git/ /tmp/gitalist.fcgi/
Re: running Gitalist as a sub-directory of my main web site
by Anonymous Monk on Sep 06, 2011 at 13:24 UTC