Plesk

How to create Nginx reverse proxy for Node.js application and let Nginx handle SSL on Plesk server?

Question

How to create Nginx reverse proxy for Node.js application and let Nginx handle SSL on Plesk server?

Answer

If the Node.js and the application are configured via Plesk, as per this article: How to run Node.js application via Plesk, no further configuration is required. Nginx will act as a proxy serving HTTPS requests to the application on port 443.

Click on a section to expand

In case Node.js/application is configured manually

  1. Log into Plesk

  2. Uncheck Proxy mode option at Domain > example.com > Apache and Nginx Settings.

  3. Configure Nginx to forward all HTTPS requests made to the app domain URL to the port in which Node.js app is listening (in this example port 5500), adding the following additional directive below at Domains > example.com > Apache & Nginx Settings > Additional Nginx directives

    location / {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $http_host;
    proxy_pass http://127.0.0.1:5500;
    }

  1. Click Apply button.