Question

Can I install NodeJs on my subdomain while my droplet was installed with Wordpress configuration ? ( Ubuntu 16.04)

Can I install NodeJs on my subdomain while my droplet was installed with Wordpress configuration ? ( Ubuntu 16.04)


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you’re using NGINX you can use this server block.

server {
  listen 80;
  listen [::]:80;

  server_name domain.com sub.domain.com;

location / {
  proxy_pass http://localhost:3000; # nodejs is on the same machine
  # proxy_pass http://192.168.1.1xx:3000; # if on a different machine in the local network.
  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-Proto $scheme;
}

Yes, you just need to add this as the vhost in apache:

<VirtualHost *:80>
ServerName subdomain.yourdomain.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>

Expecting that Node is installed and listening on localhost port 3000