Skip to content
Runbook

Install Nginx on Arch

High-performance web server, reverse proxy, load balancer and HTTP cache.

Toolweb-serverreverse-proxyload-balancerhttpproxy

Installation

Nginx (Arch repositories) · pacman
sudo pacman -S nginx

Verify the installation

Verify
nginx -v

Service

Start
sudo systemctl start nginx
Stop
sudo systemctl stop nginx
Status
sudo systemctl status nginx
Restart
sudo systemctl restart nginx
On boot
sudo systemctl enable nginx

Important files

TypePathDescription
config/etc/nginx/nginx.confMain configuration file.
data/usr/share/nginx/htmlDefault document root.
log/var/log/nginxAccess and error logs.

Default ports

80

Command-line tools

  • nginxThe server binary; nginx -t to test, nginx -s reload to reload.

Uninstall

Uninstall
sudo systemctl stop nginx
sudo pacman -Rs nginx

Good to know

  • The arch nginx package uses a single /etc/nginx/nginx.conf; add your own include for extra server blocks.
  • Enable at boot with sudo systemctl enable nginx.
  • An nginx-mainline package is available for the latest features.

Installation on Arch Linux

sudo pacman -S nginx installs the server. Enable and start it with sudo systemctl enable --now nginx. The default document root is /usr/share/nginx/html and it listens on port 80.

Configuration

Arch keeps a single /etc/nginx/nginx.conf. To organize multiple sites, add an include /etc/nginx/sites/*.conf; line yourself and create that directory; there is no Debian-style sites-available layout. Validate with nginx -t before sudo systemctl reload nginx.

Stable vs mainline

The nginx package follows the stable branch. For the newest features, install nginx-mainline instead — do not install both at once.