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: 6 years ago
Size: 862 bytes
 

Contents

Class file image Download
server { listen 80; server_name example.com www.example.com; root /var/www/example.com; index index.php index.html; access_log off; error_log /var/log/nginx/example.com-error.log; charset utf-8; # Redirect from www if ($host = 'www.example.com' ) { rewrite ^/(.*)$ http://example.com/$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; } }