I want to point sub.example.com to example.com/sub (without actually redirecting). I've achieved this with following nginx config:
server {
listen 80;
server_name ~^(.*)\.example\.com$ ;
root /var/www/html/example.com/public_html/sub;
}
The problem is, I have an Angular app on sub.example.com and it tries to load its js resources from the below path and fails to do so (404 Not found):
http://sub.example.com/sub/inline.bundle.js
http://sub.example.com/sub/vendor.bundle.js
...
To make a build I'm using following command:
ng build --base-href /sub/
How to resolve this? Is this Angular issue or can I fix it with nginx config? I've tried the proxy_pass but with no success.