Created
February 18, 2015 01:18
-
-
Save jackmcpickle/4259a5dfc2afc6b16435 to your computer and use it in GitHub Desktop.
craft nginx conf for docker
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; ## listen for ipv4; this line is default and implied | |
listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
root /usr/cms/public; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
#server_name localhost; | |
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html | |
sendfile off; | |
error_page 404 /index.php; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
location ~ ^(.*)$ { | |
try_files $uri $uri/ /index.php?p=$uri&$args; | |
} | |
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { | |
try_files $uri /index.php?$query_string; | |
expires max; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
location ~* \.(?:css|js)$ { | |
try_files $uri /index.php?$query_string; | |
expires 1y; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:ttf|ttc|otf|eot|woff)$ { | |
try_files $uri /index.php?$query_string; | |
expires 1M; | |
add_header Cache-Control "public"; | |
} | |
# deny access to . files, for security | |
# | |
location ~* (?:^|/)\. { | |
access_log off; | |
log_not_found off; | |
deny all; | |
} | |
location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ { | |
deny all; | |
access_log off; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment