Skip to main content

Nginx Installation Guide

This guide provides all the key information and getting-started instructions after a successful Nginx installation via DeploySage-CLI.

Service Management

Manage the Nginx service using standard systemctl commands.

# Start the service
sudo systemctl start nginx

# Stop the service
sudo systemctl stop nginx

# Restart the service
sudo systemctl restart nginx

# Reload configuration without dropping connections
sudo systemctl reload nginx

# Check the service status
sudo systemctl status nginx

# Enable the service to start on boot
sudo systemctl enable nginx

Key Directories and Files

Understanding the file structure is essential for configuration.

ItemValue
Main Configuration File/etc/nginx/nginx.conf
Site Configs Directory/etc/nginx/conf.d/
Default Web Root/usr/share/nginx/html/
Log Directory/var/log/nginx/

Diagnostics and Testing

Firewall Configuration

Use these commands to diagnose issues and test your configuration.

To allow external access to your web server, you must open the necessary ports in your firewall.

# Test the configuration syntax
nginx -t

# Reload the configuration gracefully
nginx -s reload

# View access logs in real-time
tail -f /var/log/nginx/access.log

# View error logs in real-time
tail -f /var/log/nginx/error.log
# Allow HTTP traffic
sudo firewall-cmd --permanent --add-service=http

# Allow HTTPS traffic
sudo firewall-cmd --permanent --add-service=https

# Reload the firewall to apply changes
sudo firewall-cmd --reload