- Plesk Onyx
Why does the Plesk Preview feature not work for Node.js application when Default Quick Preview is enabled?
It is an expected behavior.
To make website preview work for a domain with Node.js application installed:
In Plesk, go to Tools & Settings > Website Preview page.
Select one of the other preview options Quick Preview on a domain name in Plesk or Quick Preview on an external domain name
How it works
When Node.js support is enabled for a domain, the following directives are added to domain's Apache web configuration file
PLESK_INFO: #extension nodejs begin
#extension nodejs end
Such directives are necessary to interpret Node.js scripts properly, it is individual for each domain.
When Default Quick Preview option is enabled on Tools&Settings > Website Preview page, the website's preview is available via link like http://203.0.113.2/plesk-site-preview/example.com/203.0.113.2/
URLs requests like the one above are being processed by
/etc/sw-cp-server/conf.d/plesk_site_preview.conf configuration file.
Such configuration file does not have mod_passenger module enabled and configured for each domain and this is by design. So, this is an expected behavior that Apache+nginx webservers cannot handle Node.js application for preview URLs and the script is downloaded instead of rendering content.
Node.js applications are available in preview mode when Quick Preview on a domain name in Plesk or Quick Preview on an external domain name options is selected on Tools & Settings > Website Preview page.
For example, Quick Preview on a domain name in Plesk option is enabled and example2.com website is selected, the A record for wildcard subdomain is added to DNS Settings for example2.com:
CONFIG_TEXT: *.203-0-113-2.example2.com A 203.0.113.2
Preview of websites are available via URLs like http://example.com.203-0-113-2.example2.com/ and in that case configuration file that has mod_passenger module
/var/www/vhosts/system/example.com/conf/httpd.conf is in use. That allows processing Node.js scripts properly.