To set up multiple websites on a single Ubuntu server, you can use Nginx server blocks. Follow these steps:
Step 1 : Run the following commands to update your package list and install Nginx:
Step 2 : Create the root directory for your site and an index file:
Step 3 : Set the correct permissions for your site directory:
Step 4 : Create a server block file for your domain:
Add the following configuration:
Step 5 : Create a symbolic link to enable your configuration:
Step 6 : Check if the configuration is correct:
Step 7 : Restart the Nginx service to apply the changes:
Step 8 : Visit http://example.devtutorial.io
in your web browser to confirm the setup is successful.
Congratulations! You've successfully set up Nginx server blocks on Ubuntu 24.10.