[help] Nodejs app alongside Prestashop instance on the same virtual server
I want to run nodeJS app which sole purpose is just to make some redirects based on DB queries, the app resides on main domain let's say example.com.
On a subdomain shop.example.com there is a prestashop 1.7 installed.
The virtual server software is cPanel.
Prestashop instance works as long as I don't install the node app, when I do it seems to make both example.com and shop.example.com unresponsive, and after a while it returns 503. The node app runs on port 8080.
Node app connects with the firebase instance. when the url is in the format `example.com/aS7vXbSDn9` it should ask the DB if an entry with that ID is present and redirect based on that entry value
I have posted this question on stackoverflow 9 months ago and even offered a bounty but no success. Please help, it's a business Idea I had which is stalled by this sadly
-
Hey there! This sounds like an issue with the Node.JS vhost taking over for the subdomain as well, causing the content in the subdomain to not be served properly. I'd recommend reviewing our guide at How to Install a Node.js Application | cPanel & WHM Documentation as that is the only way to get Node.JS to properly interact with cPanel. Even then, our support is extremely limited, but we'd be happy to check your server's configuration through a ticket if you're not able to get a test app to work properly with those steps. 0 -
Thank you! The problem was that my app entry file was named index.js instead of app.js. Renaming to app.js fixed the issue! Now the only problem I have is that my express app handles also the requests from the subdomain - it shouldn't do that. But I reckon you don't know anything about Express.js so I will be nagging someone else now :) thanks! 0 -
I'm glad you were able to track that down! 0 -
ok so I am fighting with this for so long already, you guys are my only hope even stackoverflow and Discord programming/devops groups wouldn't help me (did not get any answers) fixing the app filename helped for 503 error, but now I am struggling to have Prestashop working. I figured my problem is not caused by Express app by itself, but wrong routing rules? I did long hours of research but I guessmy devops knowledge gap is just too big, anyway, found different solutions using for example Virtual Host (which I cannot try because the server is a VPS - already asked the support and they suggested trying with htaccess) my current .htaccess in root directiory # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN PassengerAppRoot "/home/domain/public_html/approot" PassengerBaseURI "/" PassengerNodejs "/home/domain/nodevenv/public_html/approot/10/bin/node" PassengerAppType node PassengerStartupFile app.js # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END RewriteEngine On RewriteBase / RewriteRule /(.*)?$ https://127.0.0.1:8080/$1 [P] # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php73" package as the default "PHP" programming language. AddHandler application/x-httpd-ea-php73 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit
tried various approaches found in different parts of the inernet like:RewriteEngine On RewriteBase / RewriteRule ^shop/(.*[^/])/?$ https://127.0.0.1:443/ [P] RewriteRule /(.*)?$ https://127.0.0.1:8080/$1 [P]
but needless to say none of them worked. TL;DR basically need to have node server with 1 endpoint working on root domain `domain.com/` and prestashop on subdomain `shop.domain.com/` right now any requests to that subdomain result in the same response as `domain.com/` if I call something like `shop.domain.com/subpage` then it works normally, so I have certainity Prestashop instance is working fine. it's just NodeJS Express app steals all requests to that subdomain root please please help me, I am so desperate already0 -
It does sound like a routing or handling issue, but I don't have additional details on my end on how that is structured. It might be best to submit a ticket to see if our team can do some more troubleshooting with this. 0
Please sign in to leave a comment.
Comments
5 comments