Production Level Knowledge & Tips

  1. 未分類
  2. 17 view

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

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]]

未分類 recent post

  1. Install sbt 1.0.0 and run sample template

  2. Visualization of Neural Network and its Train…

  3. [Machine Learning]Created docker image includ…

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

  5. [Hive]Get top n items for each category

関連記事

PAGE TOP