Created
April 11, 2013 15:15
-
-
Save JonMcL/5364214 to your computer and use it in GitHub Desktop.
Nice Drupal gist found on http://www.systemseed.com/blog/drupal-nginx-fastcgi-setup-and-configuration
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 mydomain.com; | |
| rewrite ^/(.*) http://mydomain.com permanent; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.mydomain.com; | |
| access_log /path/to/mydomain.com/log/access.log; | |
| error_log /path/to/mydomain.com/log/error.log; | |
| root /path/to/drupal/root/; | |
| index index.php; | |
| if (!-e $request_filename) { | |
| rewrite ^/(.*)$ /index.php?q=$1 last; | |
| } | |
| error_page 404 index.php; | |
| # hide protected files | |
| location ~* .(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.*|Repository|Root|Tag|Template)$ { | |
| deny all; | |
| } | |
| # hide backup_migrate files | |
| location ~* ^/files/backup_migrate { | |
| deny all; | |
| } | |
| # serve static files directly | |
| location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ { | |
| access_log off; | |
| expires 30d; | |
| } | |
| location ~ .php$ { | |
| fastcgi_pass 127.0.0.1:9000; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| fastcgi_param QUERY_STRING $query_string; | |
| fastcgi_param REQUEST_METHOD $request_method; | |
| fastcgi_param CONTENT_TYPE $content_type; | |
| fastcgi_param CONTENT_LENGTH $content_length; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment