in reply to Mojolicious to serve more openAPIs

I have modified existing Apache virtual servers so that they listen to port 8080 instead of 80.

Then I have installed NGINX to receive connections to port 80 and defined one server block for each Apache virtual server with proxy_pass set to the correponding Apache virtual server.

This allows me to use all the existing CGI applications.

I have then created a server block for the new api.example.com with proxy_pass set to localhost:3000:

server { listen 80; listen [::]:80; server_name api.example.com; location / { proxy_pass http://localhost:3000; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #try_files $uri $uri/ =404; } }
Then I have created two Mojolicious apps, to be mounted via Toadfarm:

#!/usr/bin/perl use Toadfarm -init; mount "/path/to/api01.pl" => { "X-Request-Base" => "http://api.example.com/api01" }; mount "/path/to/api02.pl" => { "X-Request-Base" => "http://api.example.com/api02" }; start ["http://*:3000"], workers => 8;
And I've created the files /path/to/api01.pl:

use Mojolicious::Lite; get '/' => {text => 'Hello! api01 here'}; app->start;
and /path/to/api02.pl:

use Mojolicious::Lite; get '/' => {text => 'Hello! api02 here'}; app->start;
I can then start the script:

$ ./api_start.pl start [2019-02-08 17:17:49.47784] [63828] [info] Mounting api01 with conditi +ons [2019-02-08 17:17:49.48110] [63828] [info] Mounting api02 with conditi +ons * Starting the process api_start_pl ...done. (already running with pid=63819)
But from browser api.example.com/api01 and api.example.com/api02 give me a "Raptor not found Mojolicios message".

Any suggestion? Thanks.

2019-02-10 Athanasius changed <pre> to <code> tags