Advice on hosting a server with https and custom domain

I’d like some advice on how to best host a https / WebSocket server with a custom domain.

The server serves some static files (index.html etc) and also connects to a WebSocket. It is written in Dart, but the framework / language is probably not that important, and could be written in node.js or similar.

I have hosted a node.js server previsouly using nginx and letsencrypt and used a few bash scripts to set things up, but i’m not very experienced with DevOps and i found the previous solution a bit cumbersome.

I would like a simple solution as possible and easy to set up. I’m considering using Docker. Would you recommend Docker in this case?

Do i need to use nginx, or can i do without? I might want to support other servers on this Linode in the future.

I have a custom domain i need to link it to, and i also need https support.

Do you have experience with a similar solution and could you advice me on some best practices / easy setup? Thanks!

Sorry for a somewhat lengthy post.

6 Replies

Linode Staff

Hi @erlend! I wouldn't recommend Docker for a single site setup unless you have something specific in mind that Docker would make easier for you. Generally, the Nginx reverse proxy setup to pass port 80/443 connections along to Dart or node.js is the way to go. You can set up Nginx to forward to any port needed, so it should work well for you. You can also set up Apache as a reverse proxy but it's not as easy and may not perform as well in all situations.

There's official info on using Nginx as a reverse proxy here:

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

And we have a guide on doing so on a Linode here:

https://www.linode.com/docs/guides/use-nginx-reverse-proxy/

Thanks for you answer @mjones!

Do i really need nginx though? Or can i do without by using iptables to open the needed ports?

Thanks,
Erlend

@erlend writes:

Do i really need nginx though? Or can i do without by using iptables to open the needed ports?

You are talking about two different things here. iptables(8) is not a reverse-proxy…it's a firewall. Based on your limited description and @mjones reply, opening ports in the firewall is not enough. I would say that you need nginx

-- sw

@stevewi i guess my question really is, do i need a reverse-proxy?

I can't just do with a node/dart server alone?

I'm not familiar with node.js or dart but, if they can do what nginx does, then no. If they can't then you need something to front-end them that can…and pass requests/replies between the two.

Opening ports 80 & 443 in your firewall is a given no matter which you choose so iptables(1) is immaterial to the decision.

-- sw

I found the following article which explained to me what a reverse-proxy is and why i should use it with a node.js. Maybe it can help someone else out there :)

https://medium.com/intrinsic/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct