[Dancer-users] deploying multiple dancer websites on localhost with mod_proxy

P Kishor punk.kish at gmail.com
Tue Mar 9 00:21:00 CET 2010


On Mon, Mar 8, 2010 at 5:04 PM, P Kishor <punk.kish at gmail.com> wrote:
> replying to myself, with a resolution, and a possible new problem.
>
> On Mon, Mar 8, 2010 at 11:12 AM, P Kishor <punk.kish at gmail.com> wrote:
>> starting a new thread, for clarity sake. Is the following possible
>> with mod_proxy (I have fudged the prompts below to illustrate my
>> scenario)?
>>
>> On my laptop, with Apache
>> ----------------------------------------
>> punkish ~/dance1$./dance1.pl
>>>> Dancer server xxxxx listening on http://0.0.0.0:3000/
>> == Entering the development dance floor ...
>>
>> punkish ~/dance2$./dance2.pl
>>>> Dancer server xxxxx listening on http://0.0.0.0:3001/
>> == Entering the development dance floor ...
>>
>> punkish ~/Documents/dance3$./dance3.pl
>>>> Dancer server xxxxx listening on http://0.0.0.0:3002/
>> == Entering the development dance floor ...
>>
>> Then, from my browser
>>
>> http://localhost/dance1
>> http://localhost/dance2
>> http://localhost/dance3
>>
>>
>
>
> There is something weird with Apache. Seems like under certain
> conditions, or for certain settings, Apache doesn't recognize changes
> in conf with just a simple 'apachctl graceful'. After struggling with
> this for a day and a half, I remembered something similar happening a
> few months ago with mod_rewrite. The solution was to reboot the
> machine. I know this sounds stupid, and has no basis in scientific
> logic, but I rebooted the laptop, and bingo! mod_proxy started
> working.
>
> I do hope this helps someone else.
>
> Now, a new problem... so, I have the following on my hard disk
>
> ~/dance/punkishdance %./punkishdance.pl
>>> Dancer server 2139 listening on http://0.0.0.0:3000
> == Entering the development dance floor ...
>
> And, I have the following in my httpd.conf file
>
> ProxyRequests Off
>
> <Proxy *>
>        Order deny,allow
>        Allow from all
> </Proxy>
>
> ProxyPass /punkishdance/ http://localhost:3000/
> ProxyPassReverse /punkishdance/ http://localhost:3000/
>
> Now, when I point my browser at http://localhost/punkishdance, I get
> my website, except...
>
> the browser can't retrieve stuff under ~/dance/punkishdance/public,
> for example, the browser throws a 404 for
> http://localhost/punkishdance/public/css/grid.css which is at
> ~/dance/punkishdance/css/style.css
>
> I can't get it directly, and of course, I can't get it included in web
> page, via main.tt. How do I correct this?


In fact, the browser is unable to get any file directly from under
~/dance/punkishdance

the stylesheets, the images, nothing comes through. In my dancer
routes, I need the equivalent of

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


>
> Which brings me to an associated question. I have the following routes in my app
>
> get '/:p' => sub {
>    pass unless (defined params->{p});
>    template 'page', { page => _page(params->{p}), name => params->{p} };
> };
>
> get '/' => sub {
>    template 'page', { page => _page('Intro-Page'), name => params->{p} };
> };
>
> Why is it not possible to combine the above two into a single route
> with an optional param kinda like so
>
> get '/:p?' => sub {
>    params->{p} eq 'Intro-Page' unless params->{p};
>    template 'page', { page => _page(params->{p}), name => params->{p} };
> };
>
>




-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the Dancer-users mailing list