Connect to a Plesk server via SSH.
Install the nginx reverse proxy component using the following command:
# plesk installer --select-release-current --install-component nginx
Manage nginx reverse proxy:
To check the current status of nginx reverse proxy:
# /usr/local/psa/admin/sbin/nginxmng --status
To enable the nginx reverse proxy service, run:
# /usr/local/psa/admin/sbin/nginxmng --enable
To disable the nginx reverse proxy service, run:
# /usr/local/psa/admin/sbin/nginxmng --disable
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
Uncheck Proxy mode
option at Domain > example.com > Apache and Nginx Settings.
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;
}
location / {
proxy_pass http://server_IP:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}