プログラミング + アカデミック + 何か面白いこと

  1. Programming
  2. 32 view

[Perl][Dancer][Apache][Ubuntu12.04LTS]How to set apache to run Dancer via reverse proxy

I was annoyed something when I introduction of light Web framework Dancer for Perl.
This article is the memo about that.

References:

Install Dancer

$ perl -MCPAN -e shell
cpan> install Dancer
cpan> quit

Hello World

bin/app.pl

#!/usr/bin/env perl
use Dancer ':syntax';
#use sharss;

get '/' => sub {
   'Hello, World!';
};

dance;

app.psgi

require 'bin/app.pl';

Test

Run.

perl app.psgi

“Hello, World!” will be shown when you access http://localhost:3000/.

Setting reverse proxy

install mod_proxy module

sudo apt-get install libapache2-mod-proxy-html
sudo apt-get install libxml2-dev

Setting conf file

<Location "/test">
    RequestHeader set request-base /var/www/something
    ProxyPass http://localhost:3000
    ProxyPassReverse http://localhost:3000
</Location>

If you add “/” the end of ProxyPass and ProxyPass Reverse, the reverse proxy maybe don’t work.
I stacked a little bit about it.

validation of mod_proxy

sudo a2enmod proxy
sudo a2enmod proxy_http headers
sudo /etc/init.d/apache2 restart

Test

“Hello, World!” will be shown when you access http://localhost/test.

That’s all.

[[amazon2][4873115671][4844328654]]

Programming recent post

  1. Install sbt 1.0.0 and run sample template

  2. [Machine Learning]Created docker image includ…

  3. [Node.js]How to write batch script with Node.…

  4. [Play][Scala]Develop Request Driven Batch Usi…

  5. [OpenCV][Ruby]Auto check web page design corr…

関連記事

PAGE TOP