Setup Nginx on NetBSD 7.1 – Part 1
Hello everyone,In this short tutorial, we will look at how to install nginx on a NetBSD 7.1 system.
Nginx as we all know is a very powerful HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server which has a lots of features including Serving static and index files, autoindexing, open file descriptor cache and Accelerated reverse proxying with caching, load balancing and fault tolerance.
This tutorial was written using the following system parameters
Hostname – server.example.com
IP Address – 192.168.234.152/24
Operating System – NetBSD 7.1
In this tutorial,we will install Nginx using the pkgin package manager.For more information on how to setup pkgin on NetBSD 7.1,visit the article on install packages on netbsd 7.1 using pkgin
Step 1 : Setup
We will start by searching for the available versions of nginx available on NetBSD by running the command below:
pkgin search nginx
Output should be similar to the below
# pkgin search nginx nginx-1.13.10 = Lightweight HTTP server and mail proxy server nginx-1.12.2nb1 > Lightweight HTTP server and mail proxy server =: package is installed and up-to-date <: package is installed but newer version is available >: installed package has a greater version than available package
step 2: Installation
We will proceed by installing nginx by running the command:
pkgin install nginx
After Installation is completed,we need to enable the nginx service by running the following commands
cp /usr/pkg/share/examples/rc.d/nginx /usr/rc.d/
And then set nginx=YES in the /etc/rc.conf file or run the below:
echo “nginx=YES” >> /etc/rc.conf
Now start nginx by running :
output should be similar to the below
# /etc/rc.d/nginx start Starting nginx.
We can confirm Nginx is running by checking if server is listening on port and http service is running by running the command
sockstat -4 -l | grep http
Output should be be similar to the below:
# sockstat -4 -l | grep http USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS nginx nginx 15789 7 tcp *.http *.* root nginx 21493 7 tcp *.http *.*
Congratulation, server is running Nginx.
The configuation files are located in the /usr/pkg/etc/nginx directory and the default Document Root is /usr/pkg/share/examples/nginx/html.In part 2 of this article,we will look at how we can install php on NetBsd 7.1
step 3 : Testing
Open a web browser and type the URL in the format http://IP .In this tutorial our system is configured with IP – 192.168.234.152/24.Output should should be similar to the below.