Guide to Deploying a Website on DigitalOcean Droplet/Server

Guide to Deploying a Website on DigitalOcean Droplet/Server

1. Ensure that you've thoroughly tested, optimized, and uploaded your code to a GitHub repository.

YouTube Step-by-Step Tutorial: Guide to Deploying a Website on DigitalOcean Droplet/Server

2. Begin by creating a DigitalOcean account, you can sign up using this link (https://m.do.co/c/ac8ddb2ca45f) and get a $200 credit that is valid for 60 days and then proceed to create a droplet. Set either a password or an SSH key, along with a hostname for your droplet.

3. Log in to your droplet using a terminal by typing the following command:

ssh root@your-ip-address

4. Install Node.js and npm on Ubuntu. You can follow this guide to install them: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04

5. Clone your repository to your droplet. Make sure you've created a personal access token to clone it.

6. After cloning, navigate to the folder where you've cloned the code and run the command:

npm install

7. Once you've installed the required packages, start the project to ensure it's functioning correctly on your IP address.

8. Install Nginx on your droplet to host your website on a domain, sub-domain, or your droplet's IP address. You can follow this guide to install Nginx: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04

9. Link your domain or sub-domain and configure Nginx settings.

Move to the following folder and configure file:

/etc/nginx/sites-available 

Configuration code:

server {
    listen 80;
    server_name domain-or-sub-domain-url-here;

    root /folder-path;
    index index.html;

   location / {

        proxy_pass http://ip-address-here:port;
        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;
       }
}
sudo nginx -t
sudo systemctl reload nginx

10. Enhance the security of your website by adding an SSL certificate. You can follow this guide to secure it: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04

11. Create a production build using the command

npm run build

12. Install PM2 and use it to keep your app running.

npm install pm2@latest -g
pm2 start npm --name "aamax" -- run start
pm2 save

Additional useful commands:

pm2 logs
pm2 status
pm2 restart {id}

Congratulations! Your app is now up and running smoothly. Alhamdulillah.

13. Consider enabling the backup for your droplet.

Note:

When uploading the backend code, you will require additional configurations for the backend and database, such as MongoDB and PostgreSQL.

Additionally, you can add multiple sites to your droplet.

Related Blogs

Best Niche Edit Backlinks Services

Best Niche Edit Backlinks Services

Are you ready to elevate your online presence and boost your website's authority? If you are, then our premium niche edit services are just right for ...

Full Stack Web Development Company

Full Stack Web Development Company

Are you dreaming of a top-notch website that not only looks stunning but works flawlessly? Well, say hello to AAMAX! Your new full-stack web developme...

Average Cost of Web Application Development

Average Cost of Web Application Development

When it comes to developing a web application, it’s all about understanding the costs involved, right? Now, this can be just as crucial as the app its...

Keyword Research Specialist

Keyword Research Specialist

You need a keyword research specialist, and we’re here to help you out! The team here at AAMAX completely understands that the foundation of any succe...

Website Competitor Analysis Report

Website Competitor Analysis Report

The world of business is all about figuring out the best way to gain that oh-so-valuable competitive advantage over your competitors. Knowing what you...

SEO Consulting for Enterprise Companies

SEO Consulting for Enterprise Companies

Your enterprise should feel like an empire, strong, powerful, and ever-growing, but is it? The arena out there is competitive, and there are so many o...

Freelance Local SEO Consultant

Freelance Local SEO Consultant

Even to this day, your location can have a massive impact on your business, but your local SEO can also play a pretty big role. So, what not elevate y...

SEO Campaign Manager

SEO Campaign Manager

Campaign management is all about unlocking potential, and guess what? AAMAX wants to help unlock your potential! We’re here to help you truly thrive a...

SEO Auditing Service

SEO Auditing Service

Is your website performing at its best? How do you know? It might be handy to get the professionals to chime in! Here at AAMAX, we’re the experts who ...

SEO Keyword Research Services for Small Business

SEO Keyword Research Services for Small Business

Every entrepreneur wants their company to succeed, and that means investing in their website, as well as multiple areas around it. SEO keyword researc...

Local Citation Building Packages

Local Citation Building Packages

Local citations are mentions of your company’s location, phone number, or name online. These often play a large role in whether your business ranks we...

SEO Agency Near Me

SEO Agency Near Me

If you are in need of an SEO agency that can provide you with everything you need, then you’ve come to the right place. Here at AAMAX, we are a full-s...

Digital Marketing Packages

Digital Marketing Packages

Getting help with your marketing strategies is the ideal solution if you want to implement the best practices to drive sales and grow your business. H...

Custom Web Application Development

Custom Web Application Development

You need to know how important it is to have a digital presence! It’s crucial, and you could have the best product or service out there, but if there’...

SEO Consultant for Attorneys

SEO Consultant for Attorneys

As an attorney who is working for themselves, you'll be looking for any way possible to be able to increase your visibility and attract more clients. ...