How to install Nginx on Debian 8 Jessie

Download the repository key file, add the key to apt-get and delete the file:

:~# cd /opt/
:~# wget
:~# sudo apt-key add /opt/nginx_signing.key
:~# rm /opt/nginx_signing.key

Add the Nginx repository to /etc/apt/sources.list:

Nginx Repository

deb jessie nginx
deb-src jessie nginx

Install Nginx:

:~# apt-get update
:~# apt-get install nginx

Starting, stopping, and reloading the configuration:

:~# nginx            // start server
:~# nginx -s stop    // fast shutdown
:~# nginx -s quit    // graceful shutdown
:~# nginx -s reload  // reloading the configuration file

For security reasons, disable PHP’s fix_pathinfo setting in php.ini:


If your SSL certificate requires an additional chain certificate to be fully trusted by browsers, you have to copy both certificates into one file where the chain certificate has to be placed after the regular certificate. Make sure both are separated by a line break:

Your certificate here
Chain certificate here

You can then refer to this chained file in the Nginx configuration:

ssl_certificate     /opt/ssl/;
ssl_certificate_key /opt/ssl/;
ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers         HIGH:!aNULL:!MD5;

In case you have multiple websites, with each site having its own password protected certificate, you will be asked for all passwords every time you start or stop Nginx:

root@Debian-82-jessie-64-minimal ~ # nginx
Enter PEM pass phrase:
Enter PEM pass phrase:
Enter PEM pass phrase:

As you can see though, Nginx doesn’t tell whose site’s password it’s actually asking for. I assume certificate passwords are asked in alphabetical order of the sites’ configuration file names. Check /etc/nginx/conf.d.

I also recommend reading the following articles on installing Nginx and using it together with PHP over FastCGI: