nginx


Shipping your Nginx logs to Elasticsearch using Logstash

First of all create a new log format in /etc/nginx/nginx.conf and add/replace an access log directive: log_format logstash ‘$http_host ‘ ‘$remote_addr [$time_local] ‘ ‘”$request” $status $body_bytes_sent ‘ ‘”$http_referer” “$http_user_agent” ‘ ‘$request_time ‘ ‘$upstream_response_time’; access_log /var/log/nginx/access.log logstash; Install Elasticsearch like described here. Install Logstash like described here. Add the following pattern to logstash in /opt/logstash/paggerns/nginx: NGUSERNAME […]


Installing Nginx 1.7.9 with Google Pagespeed on Ubuntu 14.04 (Trusty)

Basically we're going to rebuild .deb packages, adding the Pagespeed module. So first we're adding the repo and preparing some dependencies: add-apt-repository -s -y ppa:nginx/development apt-get update apt-get -y install devscripts apt-get -y build-dep nginx=1.7.9   We're building the packages using an unprivileged user: adduser bob −−shell /bin/bash \ –disabled-password –gecos bob sudo su – […]


Create self-signed SSL certificate for Nginx

First of all create the server key: openssl genrsa -des3 -out self-signed.key 2048 Enter a password twice and note it! Create the CSR (when requested, enter the password that you used above): openssl req -new -key self-signed.key -out self-signed.csr Answer the questions and put your domain name that you want to use the certificate for […]


Install Nginx 1.6.0 on Debian Wheezy

Wheezy comes by default with Nginx 1.2 which is already quite old. In my case I needed some features that were only available above 1.3.3 – the latest version is currently 1.7.2. To install it you have to add this repo: echo "deb http://dotdeb.netmirror.org/ stable all" >> /etc/apt/sources.list.d/dotdeb.list echo "deb-src http://dotdeb.netmirror.org/ stable all" >> /etc/apt/sources.list.d/dotdeb.list Add […]


Configuring Nginx for WordPress

A typical Vhost file (for example /etc/nginx/sites-available/default) would look like this: server {   listen   80;   server_name  YOUR_SERVER_NAME;   access_log  /var/log/nginx/access.log;   root /var/www;   index index.php;   location / {    index index.php;    try_files $uri $uri/ /index.php?q=$uri&$args;   }   location ~ \.php$ {               […]


Installing Nginx with PHP5-FPM on Debian

Install PHP5-FPM as described here. Install Nginx: apt-get install nginx Check for the correct path to the socket used by php5-fpm in /etc/php5/fpm/pool.d/www.conf (to be used in the nginx configuration): listen = /var/run/php5-fpm.sock Create a virtual host in /etc/nginx/sites-available/: server {         listen   80;          root /var/www;       […]