Skip to content

Nginx on a VPS

Web server and proxy

Category
Dev / Tools
Author
F5 / NGINX
License
BSD-2-Clause
Version
1.30.5

The script is free · VPS from $2.79 per month · installs in about 30 seconds

Install over SSH

root@vps:~# sudo apt update && sudo apt install -y nginx

  • SystemUbuntu 24.04 · x86_64ok
  • Sourcegithub.com/nginx/nginxok
  • Version1.30.5ok
  • Port80/tcplisten
  • Port443/tcplisten

✓ Nginx 1.30.5 installed · about 30 seconds

root@vps:~#

Install command from the library. Output is shortened and may differ on your server.

What it is

  • Web server
  • Reverse proxy
  • HTTPS
  • Let's Encrypt

Nginx is a web server and reverse proxy. It serves static sites, proxies requests to Node.js, Python or PHP apps, and terminates HTTPS.

On a VPS, Nginx usually sits in front of all services: one IP and port 443 serve multiple domains, while each app listens only on localhost. With Certbot, Let's Encrypt certificates are issued and renewed automatically.

The command installs Nginx from the distribution repository: a stable but not the newest branch. Newer versions are published in the nginx.org repository.

  • Static file serving and caching
  • Reverse proxy for apps and WebSocket
  • HTTPS, HTTP/2 and HTTP/3
  • Multiple sites on one IP
  • Load balancing and rate limiting

Recommended plan

For Nginx: at least 1 vCPU, 2 GB RAM and 10 GB NVMe.

Minimum to run
1 vCPU · 1 GB RAM · 10 GB disk
Systems
Ubuntu 22.04 · Ubuntu 24.04 · Debian 11 · Debian 12

How to install

Three steps in the bot or one command over SSH; installation takes about 30 seconds.

  1. 01

    Choose a plan in the bot

    Open @ExpressHost_bot and pay for a VPS. The server will be ready in about 60 seconds.

  2. 02

    Add Nginx

    At the “Add-ons” step pick the script from the library, or run it later: Server settings → Scripts.

  3. 03

    Open http://server-IP — you should see the Nginx welcome page

    The bot will send the server address and login details to the chat.

Manually over SSH

Connect to the server as root and run the command. Supported systems: Ubuntu 22.04, Ubuntu 24.04, Debian 11, Debian 12.

Install command
sudo apt update && sudo apt install -y nginx

Ports

Nginx ports
PortProtocolPurpose
80tcpHTTP
443tcpHTTPS (after setting up a certificate)

After installation

  1. 1.Open http://server-IP — you should see the Nginx welcome page
  2. 2.Put the site config in /etc/nginx/sites-available/ and enable it with a symlink in sites-enabled
  3. 3.Test and apply the config: nginx -t && systemctl reload nginx
  4. 4.Issue a certificate: apt install -y certbot python3-certbot-nginx && certbot --nginx -d your-domain

Nginx FAQ

Didn’t find an answer? Message @ExpressHost_SupportBot.

How do I proxy an app on port 3000?

In the server block add location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; } and reload Nginx.

How do I update Nginx?

apt update && apt upgrade. For the newest version, add the official nginx.org/packages repository.

Where are the logs?

Access log: /var/log/nginx/access.log, error log: /var/log/nginx/error.log.

Nginx installs at checkout — in the bot.