This guide provides comprehensive instructions for installing the Nginx web server on your BrainHost VPS. We will cover the quick installation method using package managers and the detailed compile-from-source method for advanced customization.
Alex Chen
DevOps Engineer
Oct 25, 2025
10 min read

These methods use your operating system's package manager, offering the fastest and easiest way to deploy Nginx on your BrainHost VPS.
Bash
# Update the local package index
sudo apt update
# Install Nginx
sudo apt install nginx -y
# Verify the service status
sudo systemctl status nginx
Bash
# Install the EPEL repository (often necessary for Nginx)
sudo yum install epel-release -y # or sudo dnf install epel-release -y
# Install Nginx
sudo yum install nginx -y # or sudo dnf install nginx -y
# Start and enable Nginx to run on boot
sudo systemctl start nginx
sudo systemctl enable nginx
Compiling Nginx from source is the ideal choice when you need to include specific third-party modules, define custom paths, or use the very latest version, ensuring your BrainHost VPS is running a perfectly tailored web server.
You need development tools and libraries for features like SSL and compression.
| OS | Command |
|---|---|
| Debian/Ubuntu | sudo apt update && sudo apt install build-essential libpcre3-dev zlib1g-dev libssl-dev -y |
| RHEL/CentOS | sudo yum groupinstall "Development Tools" -y && sudo yum install pcre-devel zlib-devel openssl-devel -y |
Replace 1.27.0 with the latest stable version available.
Bash
cd /usr/local/src
# Download the source code (check the official Nginx site for the latest version)
sudo wget http://nginx.org/download/nginx-1.27.0.tar.gz
# Extract the archive
sudo tar -zxvf nginx-1.27.0.tar.gz
# Change directory into the source folder
cd nginx-1.27.0
Use the ./configure script to define installation paths and enable desired modules. This example includes common and useful options for a robust installation on your BrainHost VPS:
| Parameter | Function |
|---|---|
--prefix | Defines the main installation directory. |
--user/--group | Sets the non-privileged user/group for worker processes. |
--with-http_ssl_module | Crucial: Enables HTTPS/SSL support. |
--with-http_v2_module | Enables HTTP/2 support for faster connections. |
--with-http_gzip_static_module | Allows serving pre-compressed .gz files. |
--with-http_stub_status_module | Enables a simple status page for monitoring. |
Bash
sudo ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-pcre \
--with-zlib \
--with-cc-opt='-O2'
Bash
sudo make
sudo make install
Since you compiled Nginx, you need to manually set up the user, group, and a system service.
sudo groupadd nginx
sudo useradd -r -g nginx -s /bin/false -M nginx
# Use your preferred editor (e.g., nano or vi) to create the file
sudo nano /etc/systemd/system/nginx.service
[Unit]
Description=The Nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
After installation, open your web browser and navigate to your BrainHost VPS's IP address or domain name:
http://[Your_VPS_IP_Address]A successful installation will display the Nginx default welcome page.
Would you like me to help you draft the next section of your guide, perhaps focusing on basic Nginx configuration or setting up your first virtual host?
Tags
Alex Chen
DevOps Engineer
DevOps Engineer specializing in cloud infrastructure and automation.
Related Articles

Practical VPS Guide for Engineers: From Hobby to Production
A comprehensive guide for engineers covering VPS fundamentals, virtualization stack, practical use cases, best practices for networking, storage, security, and building a production-ready system.

Effortless Deployment: Install Docker and Run Hello World on Your BrainHost VPS
A step-by-step tutorial guiding you to install the Docker Engine on your BrainHost VPS (Ubuntu/Debian systems) and run your first container (Hello World), ensuring consistent, rapid deployment.

Comprehensive Guide: Installing Java JDK on Your BrainHost VPS
A detailed guide for BrainHost VPS users covering multiple ways to install the Java Development Kit (JDK), including quick installation via package managers (APT, YUM/DNF) and manual installation of official OpenJDK releases.
BrainHost - A reliable VPS hosting platform offering high-performance virtual servers with advanced management capabilities.