nginx with php5-fpm under Debian 8.2

How to configure nginx with php5-fpm under debian 8.2? All of the config files with examples of vhosts.

nano /etc/nginx/caching.conf

 location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
 expires         30d;
 access_log      off;
 log_not_found   off;
 }

nano /etc/nginx/notfound.conf

 error_page 404 /404.html;

 location /404.html {
     root /usr/share/nginx/notfound;
 }

nano /etc/nginx/php-fpm.conf

 location ~ \.(php)$ {
 fastcgi_keep_conn on;
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 }

nano /etc/nginx/nginx.conf

user mattionline;
worker_processes 2; #number of cpu cores
worker_connections 1024;
server_tokens off;

nano /etc/php5/fpm/php.ini

cgi.fix_pathinfo=0

nano /etc/php5/fpm/pool.d/www.conf

user = mattionline
group = mattionline
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1

nano /etc/nginx/sites-available/mainpage

server {
    listen 80;
    server_name mattionline.de;
    access_log /var/log/nginx/mainpage_access.log combined;
    error_log  /var/log/nginx/mainpage_error.log;

    return 301 http://www.mattionline.de$request_uri;
}

server {
    listen 80;
    server_name www.mattionline.de;
    access_log /var/log/nginx/mainpage_access.log combined;
    error_log  /var/log/nginx/mainpage_error.log;

    root /usr/share/nginx/mainpage/;
    index index.html index.htm index.php;

    include php-fpm.conf;
    include caching.conf;
    include notfound.conf;
}

nano /etc/nginx/sites-available/notfound

server {
    listen 80 default_server;
    include notfound.conf;

    access_log /var/log/nginx/notfound_access.log combined;
    error_log  /var/log/nginx/notfound_error.log;

    root /usr/share/nginx/notfound/;

    location / {
      return 404;
    }
}

nano /etc/nginx/sites-available/blog

server {
    listen 80;
    server_name mattionline.de;
    access_log /var/log/nginx/blog_access.log combined;
    error_log  /var/log/nginx/blog_error.log;

    root /usr/share/nginx/blog/;
    index index.html index.htm index.php;

    include php-fpm.conf;
    include caching.conf;
    include notfound.conf;

    location / {
        try_files $uri $uri/ /index.php$args;
    }
}

server {
    listen 443;
    server_name mattionline.de;
    access_log /var/log/nginx/blog_access.log combined;
    error_log  /var/log/nginx/blog_error.log;

    root /usr/share/nginx/blog/;
    index index.html index.htm index.php;

    ssl on;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;

    include php-fpm.conf;
    include caching.conf;
    include notfound.conf;

    location / {
        try_files $uri $uri/ /index.php$args;
    }
}

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen