Search code examples
expressdnsporthost

How to connect my domain to express app with external ip + port


I created a very basic express app which listens at port 3000 for HTTP, 4000 for HTTPS. I have static ip. How can i use my domain to access my express app. ( Currently i can access via [external ip]:[port])

NOTE: I am using raspberry pi with raspbian OS.


Solution

  • Your app has to listen on port 80 for HTTP requests and port 443 for HTTPS requests.

    Alternatively, you can use a proxy server like Nginx to handle HTTP and HTTPS, and you can configure your app to listen on any port. Also, don't forget to configure Nginx according to your app's ports.