How to proxy pass DirectAdmin in shared hosting from nginx in VPS

94 Views Asked by At
  • I have a subdomain da.myvps.com pointing to my VPS IP with nginx installed.
  • I have a shared hosting with DirectAdmin URL https://mysharedhosting:2222/evo/.
  • I want to access my DirectAdmin with my subdomain using nginx proxy pass with the following config below, so I can access the DirectAdmin by going to this URL: https://da.myvps.com/evo/ instead of https://mysharedhosting:2222/evo/.
server {
  listen 80;
  server_name da.myvps.com;

  location /evo/ {
    proxy_pass https://mysharedhosting.com:2222/evo/;
  }

  location = / {
    return 301 https://da.myvps.com/evo/;
  }

  # This endpoint is used by DirectAdmin to get data
  location /api/ {
    proxy_pass https://mysharedhosting.com:2222/evo/api/;
  }
}

I can access the web but it displaying this error below: DirectAdmin error

Do you have any idea how to fix it? Is it possible to do that? Any help would be very appreciated. Thanks a lot!

0

There are 0 best solutions below