To set up multiple websites on an Nginx server using server blocks on Ubuntu 24.04, follow these steps:
Step 1 : Ensure your system is up to date:
Step 2 : Install Nginx:
Step 3 : Create a directory for your website:
Create an index.html file:
Add some content to the file and save it. For example:
Step 4 : Adjust permissions to ensure Nginx can serve the content:
Step 5 : Create a new server block configuration file:
Configure the server block. Example:
Step 6 : Create a symbolic link to enable the configuration:
Step 7 : Check Nginx configuration for syntax errors:
Step 8 : Restart Nginx to apply changes:
Step 9 : Open a web browser and navigate to your domain (e.g., example.com) to verify that your website is serving correctly.
Congratulations! You have successfully set up Nginx server blocks on Ubuntu 24.04, allowing you to host multiple websites on a single server.