Skip to content

Instantly share code, notes, and snippets.

@psi-4ward
Last active October 19, 2016 10:44
Show Gist options
  • Save psi-4ward/8c4c5271e90801bdb381 to your computer and use it in GitHub Desktop.
Save psi-4ward/8c4c5271e90801bdb381 to your computer and use it in GitHub Desktop.
NGINX Contao 3 Config with PHP-FPM
index index.php index.html index.html;
client_max_body_size 200M;
sendfile on;
error_page 404 /404.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(tpl|html5|xhtml)$ {
deny all;
}
location ~ /\. {
deny all;
}
location ~* (/scripts|/system/logs|/system/bin|/system/config) {
deny all;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$; # use cgi.fix_pathinfo=0 in php.ini
fastcgi_pass unix:/var/run/php5-fpm-$name.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Logging
access_log /var/log/nginx/$name.access.log;
error_log /var/log/nginx/$name.error.log notice;
server {
set $name "myvhost";
listen 80;
server_name myvhost.de;
root /home/$myvhost/www;
include contao.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment