dotnet publish -c Release -o out
scp -i your-key-pair.pem -r out/ [email protected]:/home/ec2-user/app
ssh -i your-key-pair.pem [email protected]
cd /home/ec2-user/app
dotnet YourApp.dll
Ensure your EC2 instance's security group allows inbound traffic on port 5283.
HTTP (Port 80):
ec2SecurityGroup.addIngressRule(
ec2.Peer.anyIpv4(),
ec2.Port.tcp(80),
"Allow HTTP traffic from anywhere",
);
SSH (Port 22):
ec2SecurityGroup.addIngressRule(
ec2.Peer.anyIpv4(),
ec2.Port.tcp(22),
"Allow SSH traffic from anywhere",
);
Install Nginx:
sudo yum install nginx -y
Configure Nginx:
sudo nano /etc/nginx/nginx.conf