Created
December 8, 2013 13:11
-
-
Save boo1ean/7857210 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 campaign; | |
| root /Users/boo1ean/src/campaign/public; | |
| access_log /var/log/nginx/campaign.access.log; | |
| error_log /var/log/nginx/campaign.error.log; | |
| gzip on; | |
| gzip_http_version 1.1; | |
| gzip_vary on; | |
| gzip_comp_level 6; | |
| gzip_proxied any; | |
| gzip_types text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js; | |
| gzip_buffers 16 8k; | |
| gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | |
| location / | |
| { | |
| index index.php index.html index.htm; | |
| } | |
| # Enforce No WWW - I put this in an include: | |
| # include /etc/nginx/includes/enforce_non_www; | |
| if ($host ~* ^www\.(.*)) | |
| { | |
| set $host_without_www $1; | |
| rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent; | |
| } | |
| # Check if file exists | |
| if (!-e $request_filename) | |
| { | |
| rewrite ^/(.*)$ /index.php?/$1 last; | |
| break; | |
| } | |
| # catch all | |
| error_page 404 /index.php; | |
| # The PHP Inclusion Block | |
| # include /etc/nginx/includes/php; | |
| location ~ \..*/.*\.php$ | |
| { | |
| # I'm pretty sure this stops people trying to traverse your site to get to other PHP files | |
| return 403; | |
| } | |
| location ~* \.php$ { | |
| fastcgi_index index.php; | |
| fastcgi_pass 127.0.0.1:9000; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| location ~* \.(css|js|gif|jpe?g|png)$ { | |
| expires 168h; | |
| add_header Pragma public; | |
| add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
| } | |
| # Deny Any Access to .htaccess Files That May Be Present (not usually in issue in Laravel) | |
| # include /etc/nginx/includes/deny_htaccess; | |
| location ~ /\.ht | |
| { | |
| deny all; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment