NgInx

Aus Info-Theke
Zur Navigation springen Zur Suche springen


Installation

apt-get install php5-cli php5-fpm nginx-full mariadb-server mariadb-client php5-mysql

Konfiguration

server {
        listen 80;
        server_name emex;
        root /home/www/emex;
        index index.php index.html;
        location /home/www/emex {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }
         location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

Neueste Version unter Debian

cat <<EOS >/etc/apt/sources.list.d/nginx.list
deb http://ftp.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.debian.org/debian/ testing main contrib non-free
EOS

cat <<EOS >> /etc/apt/preference
Package: nginx
Pin: release a=testing
Pin-Priority: 900
EOS
apt-get update
# Info ueber verfuegbare Version:
apt-cache policy nginx
apt-get install nginx-full

Logauswertung

#! /bin/bash

DATE=$1
if [ -z "$DATE" ] ; then
	echo "Usage: NgLogTimes <date> <file1> <file2>"
	echo "Example NgLogTimes 22/Nov/2017 *.gz"
else
	shift
	while [ -n "$1" ] ; do
		FN=$1
		shift
		X=$(file $FN | grep "gzip compressed data")
		if [ -n "$X" ] ; then
			CMD=zcat
		else
			CMD=cat
		fi
#10.10.10.1 - - [27/Nov/2017:06:31:36 +0100] "GET /index.php?option=com_users&view=registration HTTP/1.0" 200 14652 "http://harmonicbrass.de/index.php?option=com_users&view=registration" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1144"

		$CMD $FN | perl -n -e "print \"\$1 Status: \$2\n\" if m!($DATE[0-9:]+).*GET [^\"]+\" ([0-9]+) !;"
	done
fi