Installing The Nginx Web Server

Installing The Nginx Web Server:

written by EON Mar 10, 2012 (Estimated Time: 5 mins)

EON 1.0 and higher no longer embeds Apache or Perl. If a web server is needed, there are 3 web server options (Apache, Lighttpd and Nignx). The web servers can be installed together but will require configuration edits to run simultaneously because the default settings are configured for port 80 and 443.

Let's show how to install and run the Nginx Web Server. With this EON release, 2 programs were introduced to simplify installs. One is the internet package installer, "rail" and the other "emp" is a program to start/stop/restart all the various programs.

Pre-requisite(s): The Binary Kit must be installed.

This assumes Internet connectivity is working and the binary kit has already been installed. So, let's install the Nginx Web Server.

rail install nginx
install nginx ...
 found local /usr/local/.store/nginx-1.1.12.tgz
 (md5 pass: a0e625e0864dbbefc370ab341a8216fd)
 installing: /usr/local/.store/nginx-1.1.12.tgz ... done

That's it, Nginx 1.4.30 is installed. Now let's start the Nginx web server, with "emp". Then, point your favorite browser to the IP address of your EON Server and you should see

emp nginx start
 nginx: start

Let's view the running Nginx processes.

emp nginx show  
1157  /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  1158  /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  1159  /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

To see other options for simply run "emp". The highlight below says, for apache, lighttpd, and nginx the options start, stop, restart and show are possible.

emp
usage: /usr/bin/emp name [ action ]
       afp [ start | stop ]
       apache | light | nginx [ start | stop | restart | show ]
       bind | dhcpd [ start | stop | restart ]
       daap | mtomb [ start | stop ]
       ndd [ start ]
       nfs [ start | stop | restart ]
       hotplug | powerd [ start | stop ]
       java [ start | show ]
       nscd | ntpd [ start | stop | restart ]
       osx [ start | stop ]
       postfix [ start | stop ]
       rsyncd [ start | stop | restart ]
       sabnzb | sickbeard | couchpotato [ start | stop ]
       transmission [ start | stop ]
       zswap | zdump [ start | stop | show ]

The Nginx web server is pre-configured with a self-signed CA certificate. You can (and should) generate your own unique self-signed CA cert using "certgen.sh"

certgen.sh
EON Storage self signed CA certificate generator
usage: /usr/local/bin/certgen.sh [ a | l | n ]
       a = apache | l = lighttpd | n = nginx

To generate a certificate for Nginx. The highlight shows the pre-configured certificate, already exist.

certgen.sh n
EON Storage self signed CA certificate generator [nginx]
 nginx certificate/key: exist already 
   /usr/local/nginx/conf/cert.pem 
   /usr/local/nginx/conf/cert.key 
 exiting: NO changes made

To remove the pre-configured certificate and generate a unique certificate.

rm /usr/local/nginx/conf/cert.pem
rm /usr/local/nginx/conf/cert.key
certgen.sh n

Configuration file location(s):

/usr/local/nginx/conf/nginx.conf

Log file location(s):

/usr/local/nginx/logs