Wednesday, July 5, 2017

FreeBSD: Install Nginx on FreeBSD 11.0

Nginx is one of the top web server on linux. When installing nginx on freebsd, its almost the same on other linux distribution like Ubuntu which uses apt, Centos which uses yum, Fedora which uses dnf, but the difference is FreeBSD uses pkg as software management tool. In this tutorial, we are going to install nginx on FreeBSD 1.0. I only use two or three commands in installing this type of application which is available on FreeBSD repository.


1. Install Nginx. Lets start installing nginx by using the command below. The first thing I noticed here in FreeBSD, you don't need to update the system like other linux distribution. When you install a software or packages, it automatically updates the system. That's a wonderful idea from FreeBSD.

pkg install nginx




2. Configure Nginx. This way we can use nginx every time we restart our system. Rehash command re-scan your PATH directories for binaries. We also configure/edit the file rc.conf in the directory etc to enable nginx when we restart our system. And then we restart the nginx to take effect the commands that we type earlier.


rehash



vi /etc/rc.conf



nginx_enable="YES"



service nginx start




3. Test on Browser. After restarting nginx, we can now test our web server by using any browser that you prefer like chrome, mozilla, or Safari. Enter your ip address of the server or type localhost and press enter to execute. Finally, you will be able to see a welcome message of nginx.


http://IP-ADDRESS



No comments:

Post a Comment