How to install Nginx in FreeBSD

There are two ways of installing Nginx in FreeBSD. You can install Nginx using package system or ports system. The second way is more flexible.

Installing Nginx from package

pkg_add -r nginx

Installing Nginx from ports

cd /usr/ports/www/nginx
make install clean

Mark modules you need for your build and press OK.

Activating Nginx

When compilation and installation are finished you can try to start Nginx:

/usr/local/etc/rc.d/nginx onestart

If you want Nginx to start with the system add to /etc/rc.conf:


Nginx configuration file is located in /usr/local/etc/nginx/nginx.conf. Nginx default document root directory is in /usr/local/www/nginx.

Got a comment?

captcha =


  1. System (20)
    1. FreeBSD (5)
    2. Linux (9)
  2. Email (2)
  3. DNS (2)
  4. Databases (1)
  5. WebServer (27)
Copyright © 2012-2015 HowToUnix - *nix Howtos and Tutorials
All Rights Reserved.