How to Set Up Nginx Server Blocks on Ubuntu 23.04

To set up multiple websites on your Ubuntu 23.04 server, you can use Nginx server blocks. These allow you to host different sites on the same server. Follow the steps below to create and configure Nginx server blocks.

Step 1 : Update and Install Nginx

Step 2 : Create Directory and Index File

Add some content to index.html.

Step 3 : Set Permissions

Step 4 : Create Nginx Configuration

Add the following configuration:

Step 5 : Enable the Configuration

Step 6 : Test Nginx Configuration

Step 7 : Restart Nginx

Step 8 : Visit Your Domain

Open your web browser and navigate to http://example.devtutorial.io.

You should see the content of your index file.

Congratulations! You have successfully set up Nginx server blocks on Ubuntu 23.04, allowing you to host multiple websites on a single server.