Last active
January 9, 2018 08:38
-
-
Save ivoba/296b5ac32da239c7d52964d53efd3013 to your computer and use it in GitHub Desktop.
SS4 lemp config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
# server_name domain.tld www.domain.tld; | |
index index.php; | |
root /var/www/current; | |
charset utf8; | |
autoindex off; | |
error_page 404 /assets/error-404.html; | |
error_page 500 /assets/error-500.html; | |
fastcgi_read_timeout 300; | |
fastcgi_send_timeout 300; | |
if ($http_x_forwarded_host) { | |
return 400; | |
} | |
location / { | |
gzip on; | |
try_files $uri/index.php $uri /index.php; | |
if (!-f $request_filename) { | |
rewrite (.*) /index.php; | |
} | |
} | |
location ^~ /assets/ { | |
location ~ /\. { | |
deny all; | |
} | |
sendfile on; | |
try_files $uri index.php?$query_string; | |
} | |
location ~ /framework/.*(main|rpc|tiny_mce_gzip)\.php$ { | |
fastcgi_keep_conn on; | |
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /(mysite|framework|cms)/.*\.(php|php3|php4|php5|phtml|inc)$ { | |
deny all; | |
} | |
location ~ /\.. { | |
deny all; | |
} | |
location ~ \.ss$ { | |
satisfy any; | |
allow 127.0.0.1; | |
deny all; | |
} | |
location ~ web\.config$ { | |
deny all; | |
} | |
location ~ \.ya?ml$ { | |
deny all; | |
} | |
location ^~ /vendor/ { | |
deny all; | |
} | |
location ~* /silverstripe-cache/ { | |
deny all; | |
} | |
location ~* composer\.(json|lock)$ { | |
deny all; | |
} | |
location ~* /(cms|framework)/silverstripe_version$ { | |
deny all; | |
} | |
# todo do we have asset cache bsuting in silverstripe? | |
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { | |
expires 1d; | |
gzip on; | |
} | |
location ~ .*\.(js|css)?$ { | |
expires 1h; | |
} | |
# php fastcgi setting | |
location ~ \.php$ { | |
fastcgi_keep_conn on; | |
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_buffer_size 32k; | |
fastcgi_busy_buffers_size 64k; | |
fastcgi_buffers 4 32k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment