FreeBSD Install Nginx Webserver

by on May 13, 2008 · 4 comments· LAST UPDATED October 9, 2008

in , ,

Q. How do I install Nginix websever under FreeBSD operating systems?

A. nginx [engine x] is a HTTP server, reverse proxy and mail proxy server written by Igor Sysoev. It is a lightweight web server, licensed under a BSD-like license. It the fifth most popular web server.

Update FreeBSD Ports Tree

Type the following command to update FreeBSD tree, enter:
# portsnap fetch update

FreeBSD Install Nginx Web Server

Type the following command to install Nginx web server:
# cd /usr/ports/www/nginx
# make install clean

Fig.01: FreeBSD Nginx Web Server Installation Options

Fig.01: FreeBSD Nginx Web Server Installation Options


Make sure you select important option such as REWRITE_MODULE, SSL_MODULE and others as per your requirements.

Turn on Nginx Webserver

Type the following command to turn on Nginx server
echo 'nginx_enable="YES"' >> /etc/rc.conf
To start Nginx, enter:
# /usr/local/etc/rc.d/nginx start

Important Information about Nginx Webserver

  • Nginx Default configuration file: /usr/local/etc/nginx/nginx.conf
  • Nginx Default http / https port: 80 / 443
  • Nginx Default error log file: /var/log/nginx-error.log
  • Nginx Default access log file: /var/log/nginx-access.log
  • Nginx Default DocumentRoot: /usr/local/www/nginx/
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 4 comments… read them below or add one }

1 cleroy61 September 14, 2010 at 12:53 pm

Can you add a nginx uninstall ?

Reply

2 aperson February 8, 2011 at 1:41 pm

cd /usr/ports/www/nginx
make deinstall
n00b

Reply

3 Steve Klabnik November 6, 2012 at 7:55 am

how can I install nginx with custom [3d-party] modules?

Reply

4 ADM April 23, 2012 at 9:06 am

to upgrade nginx and recompile with new option with ssl support on freebsd :
portupgrade -СR nginx

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: