#How to start server on HTTPS?
11 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
you can use a third party like ngrok that gives you a public accessable https url that points to your localhost. It's free 🙂
Thanks @karmic frigate , do you have any pointers on how to set this up? Also what is the best way to keep the nextJS app running? Should I use npm forever ?
you can directly install ngrok on your local machine and start the https server via ngrok http 3000. Then inside your terminal you see the public accessable url.
Also what is the best way to keep the nextJS app running
If you are on your local machine, you can usenext devornext start(withnext buildbeforenext start) and then just keep your terminal open. The same works for an vps
On a production server where I need 24/7 uptime, I won't be able to keep the terminal up..
that's why you normally buy an external server (a vps in this case) that runs 24/7 and executed the start command once
Yep, I have an external server and I have the code on there. I just can't figure out how to run it on HTTPS and how to keep the server running on port 3000 forever
you server should be available via an ip address (vercel for example is available at 76.76.21.21). So go in your DNS configuration and add your record to it, that redirects the user from example.com to your ip (cname, so the user dont see the ip). The user then can go to http://example.com and will access your server, on which nextjs is running, so the end customer will reach your page. Now you add an SSL certificate to it and then your page is reachable via https://example.com 👍
Btw: even vercel is using a third party to make domains available (cloudflare is also in the background=:
What I ended up doing is keep Nodejs as HTTP but updated my Apache reverse proxy for HTTP and HTTPS to point to this same http://localhost:3000. However, I cant figure out how to redirect from HTTP to HTTPS...Any ideas on how to do this?