Congratulations! You've successfully installed Nginx. Now, let's make sure everything is working as expected and explore some fundamental operations. This section will guide you through verifying your installation and performing basic checks to ensure your Nginx server is up and running.
The first and most crucial step is to check if the Nginx process is running. You can do this using your system's service management tools. The specific command might vary slightly depending on your operating system (e.g., systemctl on modern Linux distributions, service on older ones, or even launchctl on macOS).
sudo systemctl status nginxIf Nginx is running correctly, you should see output indicating its active status. Look for lines like 'Active: active (running)' or similar. If it's not running, you'll typically see 'inactive (dead)' or an error message. In that case, you can try starting it with sudo systemctl start nginx.
Next, we'll verify that Nginx is listening on its default port, which is port 80 for HTTP. This confirms that the web server is ready to accept incoming connections.
sudo netstat -tulnp | grep nginxThis command will show you network connections. You should see a line indicating that Nginx is listening on port 80 (often displayed as 0.0.0.0:80 or :::80). The -tulnp flags ensure we see TCP listening ports, numeric addresses, and the associated process name.
The most direct way to confirm your Nginx installation is to visit it from your web browser. Open your browser and navigate to your server's IP address or hostname. If you're running Nginx on your local machine, you can usually use http://localhost or http://127.0.0.1.
You should see the default Nginx welcome page. This page is served from the default Nginx configuration file and confirms that your web server is accessible from the outside world (or your local network).