ServerAdmin info@example.com
ServerName www.example.com
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
Order deny,allow
Allow from all
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:3000/" keepalive=On
# :3000 for morbo, :8082 for hypnotoad
ProxyPassReverse "/" "http://127.0.0.1:3000/"
RequestHeader set X-Forwarded-HTTPS "0"
ErrorLog /home/common/logs/www.example.com/error.log
LogLevel warn
CustomLog /home/common/logs/www.example.com/access.log combined
# Use the multisites cert
SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAdmin info@example.com
ServerName api1.example.com
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
Order deny,allow
Allow from all
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:3000/" keepalive=On
ProxyPassReverse "/" "http://127.0.0.1:3000/"
RequestHeader set X-Forwarded-HTTPS "0"
LogLevel debug
ErrorLog /home/common/logs/api1.example.com/error.log
CustomLog /home/common/logs/api1.example.com/access.log combined
SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAdmin info@example.com
ServerName api2.example.com
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
Order deny,allow
Allow from all
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:3000/" keepalive=On
ProxyPassReverse "/" "http://127.0.0.1:3000/"
RequestHeader set X-Forwarded-HTTPS "0"
ErrorLog /home/common/logs/api2.example.com/error.log
LogLevel warn
CustomLog /home/common/logs/api2.example.com/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
ServerAdmin info@example.com
ServerName www.example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerAdmin info@example.com
ServerName api1.example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =api1.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerAdmin info@example.com
ServerName api2.example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =api2.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
####
use Mojolicious::Lite;
app->config(
hypnotoad => {
listen => [ 'http://127.0.0.1:8082/' ],
proxy => 1,
},
morbo => {
listen => [ 'http://127.0.0.1:3000/' ],
proxy => 1,
},
);
plugin Mount => { 'api1.example.com' => '/home/common/api1.example.com/script/api' }; # API1
plugin Mount => { 'api2.example.com' => '/home/common/api2.example.com/script/api' }; # API2
plugin Mount => { 'www.example.com' => '/home/common/www.example.com/script/website' }; #WEBSITE