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; } } #### #!/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; #### use Mojolicious::Lite; get '/' => {text => 'Hello! api01 here'}; app->start; #### use Mojolicious::Lite; get '/' => {text => 'Hello! api02 here'}; app->start; #### $ ./api_start.pl start [2019-02-08 17:17:49.47784] [63828] [info] Mounting api01 with conditions [2019-02-08 17:17:49.48110] [63828] [info] Mounting api02 with conditions * Starting the process api_start_pl ...done. (already running with pid=63819)