Nginx configurations
        Posted on 19-Sep-2018
        
                    The following lines should be added inside server namespace for each local domain
Listen to specific port
listen 80 default_server;
Set server name
server_name site.example.com www.site.example.com;
Load static files from different location
location ~* \.(pdf|html|ics|mp3|mp4|ogg|wav|avi|mpeg|css|js) {
	root /new/source/path/;
}
Deliver all images by php script
location ~* \.(jpg|jpeg|png|gif) {
	try_files $uri /index.php$is_args$args;
}
Default php files handle
location ~ \.php$ {
    try_files $uri /index.php$is_args$args;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    
    # if you use port
    #fastcgi_pass php:9000;
    
    # if you use socket
    fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
Set logfiles for domain
error_log /var/log/nginx/domain-name-error.log;
access_log /var/log/nginx/domain-name-access.log;