PHP Classes

File: nginx-host-sample.conf

Recommend this page to a friend!
  Classes of devg  >  Router Lite  >  nginx-host-sample.conf  >  Download  
File: nginx-host-sample.conf
Role: Auxiliary data
Content type: text/plain
Description: Nginx config file
Class: Router Lite
Route HTTP requests by URL pattern to callbacks
Author: By
Last change:
Date: 5 years ago
Size: 862 bytes


Class file image Download
server {
    listen 80;
    root /var/www/;
    index index.php index.html;
    access_log off;
    error_log /var/log/nginx/;
    charset utf-8;
    # Redirect from www
    if ($host = '' ) {
        rewrite  ^/(.*)$$1  permanent;
    # Protect folders 
    location ~ /(vendor|src)/ {
        deny all;
    # All requests to index.php
    location / {        
        try_files $uri $uri/ /index.php?$query_string;
    # PHP-FPM on Unix-socket
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        fastcgi_index  index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        
For more information send a message to info at phpclasses dot org.