Install NGINX on FreeBSD

Installing NGINX

  1. Install NGINX
     $ pkg install nginx
  2. Create folder
     $ mkdir /data/www
  3. Find configuration file nginx.conf
    It’s either in /usr/local/nginx/conf, /etc/nginx or /usr/local/etc/nginx
  4. Edit conf file, comment out everything then add a new server block
     http {
         server {
         }
     }
  5. Add a location into the server block
     location / {
       root /data/www;
     }
     location /images/ {
       root /data;
     }
  6. Create a basic html file in /data/www
    <html>
    <head></head>
    <body><h1>hello NGINX</h1></body>
    </html>
    
  7. Start nginx
    $ nginx
    
  8. To stop NGINX use
    $ nginx -s stop

sample nginx.conf file

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s