To install Nginx on CentOS Stream 9, follow the detailed steps below.
Step 1 : To begin, update your system to ensure you have the latest packages.
Step 2 : Install Nginx using the package manager.
Step 3 : Confirm the installed Nginx version.
Step 4 : Enable and start the Nginx service.
Step 5 : Check the status of the Nginx service to ensure it is running.
Step 6 : Allow HTTP (port 80) and HTTPS (port 443) traffic through the firewall.
Reload the firewall to apply changes.
Step 7 : Create Nginx configuration for example
Inside the configuration file, add the server block settings along with a location block to specify the document root and index file.
Step 8 : Create index.html file for example.com
Inside the index.html file, add some basic HTML content, for example:
Step 9 : If SELinux is enabled, set the appropriate context.
Step 10 : Test the Nginx configuration for syntax errors.
Step 11 : Restart Nginx to apply the changes.
Step 12 : Open a web browser and enter example.com to verify the successful installation of Nginx.
Congratulations! You have successfully completed the detailed installation and configuration of Nginx on CentOS Stream 9.