Frederic Cambus

Home · Archives · Text Mode · GitHub · Twitter · RSS

Nginx on FreeBSD

· Nginx · FreeBSD

The purprose of this article is mostly to show how easy it is to compile and run custom builds of Nginx on FreeBSD, including third party modules which will be automatically fetched and built.

For a comprehensive list of compile time options and included modules for Debian and Ubuntu packages, check the following article: Nginx packages in Debian stable.

Installing Nginx via pkg:

pkg install nginx

By default, Nginx is compiled with the following options:

nginx version: nginx/1.6.0
TLS SNI support enabled
configure arguments:
--with-cc-opt='-I /usr/local/include'
--with-ld-opt='-L /usr/local/lib'

Installing Nginx using the ports collection:

cd /usr/ports/www/nginx
make config

Below is a list of all available configuration options and third party modules, showing the Lua module highlighted and selected for compilation.

Nginx on FreeBSD

Once configured, we can launch installation and clean dependencies:

make install clean-depends

Starting Nginx:

After adding the nginx_enable directive in rc.conf:

echo 'nginx_enable="YES"' >> /etc/rc.conf

We can launch the server manually:

service nginx start

Nginx is now up and running and should be launched automatically at boot time.