This will be the 3rd time I’ve typed this as DO just throws it in the garbage after I submit.
I have a droplet that was installed with the wordpress image. I have installed nodejs on the droplet and now I’m running an nodejs websocket server from /var/www/server/. I am hosting the client at /var/www/html/client/ but it will not connect to the websocket server.
After 10+ hours of searching, I think I’ve narrowed it down to something to do with the apache http-proxy but every configuration I’ve tried in the /sites-available/000-default.conf file have failed.
What am I doing wrong? Can somone point me in the correct direction? Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
You’ll need to configure a Reverse Proxy for your NodeJS server as it listens on a specific port. Usually, when talking about Reverse Proxies, Nginx is the go to WebSerivce. There is even a tutorial on how to add NodeJS with Reverse Proxy to your Droplet here;
If you however whish to use Apache, then your apache config should look something like this:
Where the ProxyPass would have your localhost IP address and the port you’ve selected your NodeJs instance to work. The above would code would be integrated with your website’s Apache config in the /etc/apache2/sites-available/ folder.