HTTP Server: NGINX

Table of Contents

Installation
Standalone server with PHP-FPM
Reverse proxy for Apache
SSL Support (HTTPS)

Standalone server with PHP-FPM

by ross at 03:54:08 on August 2, 2014

Install, configure and start PHP-FPM.

Create nginx/sites/example.com.conf:

server {
    listen       80;
    server_name  example.com www.example.com;

    access_log   /var/log/nginx-example.com-access.log  main;
    error_log    /var/log/nginx-example.com-error.log;

    index        index.php;
    root         /home/example.com/public;
    charset      utf-8;

    location / {
        try_files $uri @rewrites;
    }

    location @rewrites {
        rewrite ^ /index.php last;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        /usr/local/etc/nginx/fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

 

Comments