Sunday, November 26, 2017

How to Install Nginx on Debian Linux Stretch

There are several ways to install nginx, depending on your needs.  

1.  If you're simply experimenting and would settle for an older version of nginx, go straight to the package manager aptitude to install nginx.

2.  If you need a newer version, stable or mainline, you need to modify your /etc/apt/sources.list to point to nginx's repository before installing nginx.


3.  If you need to configure nginx's options or add other modules, you need to build nginx from the sources before installing.

1.  Settle for an older version

This is the easiest and straightforward installation.

Open a terminal window.  Hold down "ctrl" and "alt" keys and press "t".  Or click Menu/Administrator/Terminal from the taskbar.

$ apt list nginx







As of this writing, the latest nginx stable version is 1.12.2 and the latest mainline version is 1.13.7.  If you're willing to use the stable version 1.10.3 as shown above, go ahead and install it.
$ apt update
$ apt install nginx

2.  Install a newer version of nginx


If you need one of the newer versions, you have to first modify your /etc/apt/sources.list, do an update, and then install nginx.

To install the latest stable version, append these two lines into your /etc/apt/sources.list, which is a listing of software repositories where Debian looks for a package if you want to install one.

Replace "codename" with the appropriate codename for the Debian version you are using.

     deb http://nginx.org/packages/debian/ codename nginx
     deb-src http://nginx.org/packages/debian/ codename nginx

Since I am using Debian Version 9 which is codenamed "stretch", I will change these two lines into:

     deb http://nginx.org/packages/debian/ stretch nginx
     deb-src http://nginx.org/packages/debian/ stretch nginx

If you're interested with the latest mainline version, modify these two lines accordingly:
   
     deb http://nginx.org/packages/mainline/debian/ codename nginx
     deb-src http://nginx.org/packages/mainline/debian/ codename nginx

Open /etc/apt/sources.list.  Open a terminal window and type

$ nano /etc/apt/sources.list

Type in the two lines or copy and paste and then save the file.

$ apt update
$ apt install

3.  Install nginx from the sources

Download nginx by going to nginx.org and select the version that you need.

After downloading, open a terminal windows.

$ cd Downloads
$ ls nginx*

In my case, I downloaded nginx-1.13.7.tar.gz.

Unzip the file

$ tar xzf nginx-1.13.7.tar.gz

$ cd nginx-1.13.7

$ ./configure

If you need to change nginx options or enable certain nginx modules, do it here.  The example
below is the ./configure command for building nginx with additional modules as needed by LANCache:

$ ./configure --with-http_ssl_module --with-http_slice_module --with-file-aio --with-threads

$ make

$ sudo make install

How to Highlight Lines of Text in Blogger

The following lines were highlighted by generating the html codes at https://andrewsun.com/tools/syntax-highlighter/ and pasting the code in Blogger.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Integer nec odio. Praesent libero. Sed cursus ante dapibus 
diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. 
Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed 
augue semper porta. Mauris massa. Vestibulum lacinia arcu 
eget nulla. Class aptent taciti sociosqu ad litora torquent
per conubia nostra, per inceptos himenaeos. Curabitur 
sodales ligula in libero. Sed dignissim lacinia nunc. 


I used prettify here:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Integer nec odio. Praesent libero. Sed cursus ante dapibus 
diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. 
Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed 
augue semper porta. Mauris massa. Vestibulum lacinia arcu 
eget nulla. Class aptent taciti sociosqu ad litora torquent
per conubia nostra, per inceptos himenaeos. Curabitur 
sodales ligula in libero. Sed dignissim lacinia nunc. 




https://gist.github.com/

How to Install Nginx on Debian Linux Stretch

There are several ways to install nginx, depending on your needs.   1.  If you're simply experimenting and would settle for an older v...