EDIT - Added Vhosts config for the target subdomain.
I am trying to reverse proxy blog.subdomain.com
to tld.com/blog
. The current config I have right now redirects to the subdomain rather than render the data in the TLD itself.
I am using apache2 on both the servers, using AWS's Lightsail instance for both.
<VirtualHost _default_:443>
ServerAlias *
SSLEngine on
SSLCertificateFile "/opt/bitnami/apache/conf/example.com.crt"
SSLCertificateKeyFile "/opt/bitnami/apache/conf/example.com.key"
DocumentRoot "/home/bitnami/htdocs/example-landing/public"
# BEGIN: Configuration for letsencrypt
Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"
# END: Configuration for letsencrypt
# BEGIN: Support domain renewal when using mod_proxy without Location
<IfModule mod_proxy.c>
# ProxyPass /.well-known !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPass /blog http://blog.example.com
ProxyPassReverse /blog http://blog.example.com
</IfModule>
# END: Support domain renewal when using mod_proxy without Location
<Directory "/home/bitnami/htdocs/example-landing/public">
Require all granted
</Directory>
# This is for the Nodejs application running on the server
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
# This is for the actual blog
ProxyPass /blog
ProxyPassReverse /blog http://blog.example.com
# BEGIN: Support domain renewal when using mod_proxy within Location
<Location /.well-known>
<IfModule mod_proxy.c>
ProxyPass !
</IfModule>
</Location>
# END: Support domain renewal when using mod_proxy within Location
</VirtualHost>
Configuration for the blog.example.com
httpd-vhosts.conf
<VirtualHost *:80>
ServerName ghost.example.com
ServerAlias www.ghost.example.com
DocumentRoot "/opt/bitnami/apps/ghost/htdocs"
Include "/opt/bitnami/apps/ghost/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName ghost.example.com
ServerAlias www.ghost.example.com
DocumentRoot "/opt/bitnami/apps/ghost/htdocs"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/ghost/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/ghost/conf/certs/server.key"
Include "/opt/bitnami/apps/ghost/conf/httpd-app.conf"
</VirtualHost>
httpd-app.conf
Include "/opt/bitnami/apps/ghost/conf/banner.conf"
ProxyPass /bitnami !
ProxyPass / http://127.0.0.1:2368/
ProxyPassReverse / http://127.0.0.1:2368/