Sure I'm not the first one that tried to serve a domain example.com
from a example.net/bbb
, but I haven't found a solution yet.
My NGINX configuration follows the guidelines and looks something like this:
server {
listen 80;
server_name example.net;
root /path/to/aaa;
location /bbb/ {
proxy_pass http://example.com/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.(svg|ttf|js|css|svgz|eot|otf|woff|jpg|jpeg|gif|png|ico)$ {
access_log off;
log_not_found off;
expires max;
}
}
I can manage to render the root of example.com
in example.net/bbb
but:
ISSUE 1
example.net/bbb/some/path
doesn't work as expected and the index.html
of example.net
is rendered.
ISSUE 2
Any asset in example.com/assets
gives 404 because the browser look for example.net/assets
. Be great if I could solve this without placing absolute paths everywhere.