How to Install Nginx on Ubuntu 24.04

To install and configure Nginx on Ubuntu 24.04, follow these steps:

Step 1 : Ensure your system is up to date by running:

Step 2 : Install Nginx using the following command:

Step 3 : Check available application profiles for ufw:

Allow Nginx Full profile:

Step 4 : Check the status of Nginx to ensure it's running:

Step 5 : Create a directory for your website, for example, example.com, and add an index file:

- Add some content to the index.html file. For example:

Step 6 : Create a new server block configuration file for your domain:

Add configuration details for your domain. Here's a basic example:

Step 7 : Link the configuration file from sites-available to sites-enabled to enable the site:

Step 8 : Restart Nginx to apply the changes:

Step 9 : Visit your domain (example.com) in a web browser to ensure Nginx is serving your website correctly.

Congratulations! You have successfully installed and configured Nginx on Ubuntu 24.04.