######################################################################## # Laravel Nginx configuration file for FreeBSD 10.1 # # Template by Bobby Allen, April 2015 # ######################################################################## server { listen 80; ################################################################# # Enable this section if you wish to serve the site/application # # over HTTPS # ################################################################# #listen 443; #ssl on; #ssl_certificate /etc/ssl/@@APPNAME@@/cert.bundle.crt; #ssl_certificate_key /etc/ssl/@@APPNAME@@/cert.key; #ssl_client_certificate /etc/ssl/@@APPNAME@@/AlphaSSL_Root.pem; #ssl_protocols SSLv3 TLSv1 TLSv1.2; #ssl_ciphers AES:HIGH:!ADH:!MD5; #ssl_prefer_server_ciphers on; server_name @@DOMAIN@@; server_tokens off; # Application path and index file settings. root /var/webapps/@@APPNAME@@/public; index index.php; # Logging settings access_log /var/log/nginx/@@APPNAME@@/access.log; error_log /var/log/nginx/@@APPNAME@@/error.log; rewrite_log on; # Additional per-application optimisations charset utf-8; client_max_body_size 32m; # Enable GZip by default for common files. #gzip_disable "MSIE [1-6]\.(?!.*SV1)"; # compress proxied requests too. # it doesn't actually matter if the request is proxied, we still want it compressed. gzip_proxied any; # a pretty comprehensive list of content mime types that we want to compress # there's a lot of repetition here because different applications might use different # (and possibly non-standard) types. we don't really care, we still want them included # don't include text/html -- it is always included anyway gzip_types text/css text/plain text/javascript application/javascript application/json application/x-javascript application/xml application/xml+rss application/xhtml+xml application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject image/svg+xml image/x-icon application/rss+xml application/atom_xml; # increase the compression level, at the expense of additional CPU # cpu cycles are cheap virtually everywhere now, bandwidth not nearly as much gzip_comp_level 9; # the default is to gzip only HTTP 1.1 requests # we want to gzip http 1.0 requests, too, so lower the level required gzip_http_version 1.0; # set the Vary: Accept-Encoding header to force proxies to store compressed and uncompressed versions # per the nginx docs, a bug in IE 4 - 6 will cause them to not cache anything with this on # most people aren't going to care about ie 6 anymore, but keep that in mind gzip_vary on; # increase the size of the buffers which hold responses to make sure larger content can be compressed too # this means there are 16 buffers and they can each hold 8k # if you serve a lot of ridiculously large text (like combined CSS) you might consider upping this slightly gzip_buffers 16 8k; # up the minimum length a little to account for gzip overhead # this means anything smaller than 50 bytes won't be compressed. # the default is 20 bytes, which is sooo tiny it's a waste to compress gzip_min_length 50; # Set some sensible defaults for image files etc. location ~* \.(png|jpg|jpeg|gif|js|css|ico)$ { expires 30d; log_not_found off; } location / { fastcgi_param APP_ENV @@ENVIROMENT@@; try_files $uri $uri/ /index.php?$query_string; } if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } location ~* \.php$ { try_files $uri /index.php =404; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; include /usr/local/etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~ /\.ht { deny all; } }