Tools: Installing Nginx Web Server on Ubuntu 26.04 - Guide

Tools: Installing Nginx Web Server on Ubuntu 26.04 - Guide

Install Nginx

Configure Nginx as a System Service

Configure Firewall Rules

Create a Virtual Host

Secure with Let's Encrypt SSL

Next Steps Nginx is a high-performance web server built for concurrency, powering content delivery, reverse proxying, and load balancing at scale. This guide goes beyond a basic install: it configures a virtual host for your domain and secures it with a free Let's Encrypt SSL certificate. By the end, you'll have Nginx serving your domain over HTTPS with automatic certificate renewal in place. Nginx is available in Ubuntu 26.04's default APT repository. 1. Update the APT package index: 3. Verify the installed version: Enable Nginx to start automatically when the server boots. 1. Enable and start the service: 2. Check the service status: 3. Stop or restart the service when needed: Open http://YOUR-SERVER-IP in a browser. The Nginx default page confirms the service is running. Virtual hosts let Nginx serve different sites from the same server. 1. Create the web root directory: 2. Create a sample HTML page: 3. Create the virtual host configuration: 4. Enable the site, test the configuration, and reload: Verify the virtual host is serving: 1. Install Certbot with the Nginx plugin: 2. Generate and install the certificate: Certbot obtains the certificate, updates the virtual host to enable HTTPS, and configures an HTTP-to-HTTPS redirect automatically. 3. Test the auto-renewal timer: If the dry run completes without errors, automatic renewal is configured correctly. Nginx is now running and serving your domain over HTTPS. From here you can: For the full guide with additional tips, visit the original article on Vultr Docs. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ nginx -version $ nginx -version $ nginx -version $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop nginx $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart nginx $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo ufw allow 80/tcp $ -weight: 600;">sudo ufw allow 443/tcp $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo nano /var/www/app.example.com/index.html $ -weight: 600;">sudo nano /var/www/app.example.com/index.html $ -weight: 600;">sudo nano /var/www/app.example.com/index.html <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Nginx on Ubuntu 26.04</h1></body> </html> <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Nginx on Ubuntu 26.04</h1></body> </html> <!DOCTYPE html> <html> <head><title>My App</title></head> <body><h1>Hello World from Nginx on Ubuntu 26.04</h1></body> </html> $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.html; location / { try_files $uri $uri/ =404; } access_log /var/log/nginx/app.example.com-access.log; error_log /var/log/nginx/app.example.com-error.log; } server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.html; location / { try_files $uri $uri/ =404; } access_log /var/log/nginx/app.example.com-access.log; error_log /var/log/nginx/app.example.com-error.log; } server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.html; location / { try_files $uri $uri/ =404; } access_log /var/log/nginx/app.example.com-access.log; error_log /var/log/nginx/app.example.com-error.log; } $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 500;">curl http://app.example.com $ -weight: 500;">curl http://app.example.com $ -weight: 500;">curl http://app.example.com $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y $ -weight: 600;">sudo certbot --nginx -d app.example.com --agree-tos $ -weight: 600;">sudo certbot --nginx -d app.example.com --agree-tos $ -weight: 600;">sudo certbot --nginx -d app.example.com --agree-tos $ -weight: 600;">sudo certbot renew --dry-run $ -weight: 600;">sudo certbot renew --dry-run $ -weight: 600;">sudo certbot renew --dry-run - Add PHP via PHP-FPM to serve dynamic content alongside Nginx - Configure Nginx as a reverse proxy in front of a Node.js or Python application - Enable HTTP/2 support by adding http2 to the listen directive