ahmadlufiau / simple-app-nextjs-deploy

NextJS deploy to EC2 AWS using Github Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NextJS deploy using Github Actions

  • NextJS 14
  • EC2 AWS

Check this file

Additional

  • Nginx still manually config not using docker. Here example config in the server
server {
    listen 80;
    listen [::]:80;
    server_name your_domain;

    # Redirect HTTP to HTTPS
    location / {
        return 301 https://$server_name$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name your_domain;

    ssl_certificate path_ssl_public_key
    ssl_certificate_key path_ssl_private_key

    # Other SSL settings can be added here
    
    location / {
        proxy_pass IP:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Make sure allow traffic from port 80 and 443

  • Check sudo ufw status
  • sudo ufw allow 443/tcp
  • sudo ufw allow 80/tcp

Url Demo

About

NextJS deploy to EC2 AWS using Github Actions


Languages

Language:TypeScript 89.7%Language:CSS 6.4%Language:JavaScript 2.1%Language:Dockerfile 1.8%