New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Deploying Nodejs Apps in shared hosting and on root domain ?
I have bough a couple of shared hosting with nodejs support and directadmin from a couple of providers.
I can't manage to deploy the nodejs on root domain. The webserver is serving index.html from the public_html directory instead of my nodejs apps.
However if I deploy the nodejs server on the subdirectory e.g. domain.com/nodeapp, it works fine.
Is there a way to deploy the apps on root domain ?
Comments
I don't really use shared hosting but have you tried to build the app and just serve the static files directly?
No, he want run nodejs app. (e.g. expressjs)
Yes, you are right. I have express. While it can listen from subdirectory, it can't run from root directory.
Try this trick as it has worked for me in the past for few complex installations
Lets assume domain is noamanahmed.com
deploy the code /noamanahmed.com/public_html/node_app
Open then URL noamanahmed.com/node_app/
If your app loads fine,we can proceed with the next step
Go to the domains settings where you can edit the file root settings. It should be default to something like /noamanahmed.com/public_html/. Now change it to /noamanahmed.com/public_html/node_app/ ( Simply add the node_app in the end)
Now open the domain noamanahmed.com and see if it worked
It is quite a janky solution but it does work.
Hope this helps