Skip to content

Instantly share code, notes, and snippets.

@wesort
Last active July 3, 2019 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesort/5473b3cf338c97a203d6327701c2e82a to your computer and use it in GitHub Desktop.
Save wesort/5473b3cf338c97a203d6327701c2e82a to your computer and use it in GitHub Desktop.
The v1.Statamic part of nginx.conf file on forge.laravel.com
...
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/server/*;
# Start selecting and copying below
#################################################
# Edit the domain below
error_log /var/log/nginx/example.com-error.log error;
# Statamic v1 specific below
# Return a static file, if it exists, or pass to front controller
location / {
rewrite ^/admin.php.*$ /admin.php;
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_buffers 256 16k;
fastcgi_max_temp_file_size 0;
}
location ~ /\.(?!well-known).* {
deny all;
}
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri /index.php?$query_string;
expires max;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Deny access to configuration files
location ~* ^/_config {
deny all;
return 404;
}
location ~ (\.yaml) {
return 404;
}
#################################################
# End selecting and copying above:
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/after/*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment