Skip to content

Example configuration: nginx

Thomas Pike edited this page May 14, 2018 · 1 revision

Example nginx configuration contributed by user TiagoTT for DNS UI - adapted for use with SSH Key Authority

This was done on a fresh Debian 9 server and following approximately the installation instructions on the README.md file.

The following packages had to be installed:

apt-get install nginx php php-fpm php-json php-ldap php-mysql php-mbstring php-curl mysql-server

And the following NGINX server block was defined:

server {
	listen 80;
	listen 443 ssl;
	server_name ska.example.com;
	ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
	ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;

	root /srv/ska/public_html;
	index init.php;

	auth_basic "SSH Key Authority";
	auth_basic_user_file /etc/nginx/passwd;

	location / {
		try_files $uri $uri/ @php;
	}

	location @php {
		rewrite ^/(.*)$ /init.php/$1 last;
	}

	location /init.php {
		# Mitigate https://httpoxy.org/ vulnerabilities
		fastcgi_param HTTP_PROXY "";
		fastcgi_pass unix:/run/php/php7.0-fpm.sock ;
		include /etc/nginx/snippets/fastcgi-php.conf;
	}
}
Clone this wiki locally