Reputation: 79
I am trying to secure my EC2 server with HTTPS. I have a backend application written in Node.js. Here's the basic structure of my server setup:
app.use(cors());
app.use(express.json());
app.get("/", (req, res) => {
res.status(200).send("server running");
});
const port = process.env.PORT || 8080; // Assuming port is defined here for clarity
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});
So far, I have completed the following steps:
(I can't upload images for low reputation...)
Despite these configurations, I am facing a couple of issues:
The health status for port 8080 is healthy, but for port 443, it is marked as unhealthy. Currently, I can only access my application through the EC2's public IPv4 address on port 8080. Any attempt to access it via HTTPS or even HTTP without specifying the port results in a timeout.
Given this situation, I am unsure how to correctly set up HTTPS for my server to ensure it is secure. Specifically, I am looking for guidance on how to integrate the issued SSL certificate with my Node.js application, ensure all traffic goes through HTTPS, and resolve the unhealthy status of port 443 as well as the timeout issues.
Could someone provide a detailed explanation or step-by-step guide on how to secure my Node.js application with HTTPS on an EC2 server, especially focusing on how to use the SSL certificate with my application, any necessary configurations on the AWS side, and troubleshooting the mentioned issues?
Upvotes: 0
Views: 807
Reputation: 2737
Can you please verify whether you've configured the following;
Please Let me know if still you're getting issues even after configuring above settings.
Upvotes: 0