Last active
August 29, 2015 14:07
-
-
Save GoZOo/8451c2bc110d017d2c62 to your computer and use it in GitHub Desktop.
Simple Nginx configuration for Drupal
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
| # file templates/drupal7 | |
| charset utf-8; | |
| error_page 404 = @drupal; | |
| error_page 405 = @drupal; | |
| index index.html index.php; | |
| location = /favicon.ico { | |
| log_not_found off; | |
| access_log off; | |
| } | |
| location = /robots.txt { | |
| allow all; | |
| log_not_found off; | |
| access_log off; | |
| } | |
| location ^~ /cache/ { | |
| access_log off; | |
| return 404; | |
| } | |
| location ~* \.(htaccess|inc|engine|install|info|module|sh|sql|theme|tpl\.php)$ { | |
| access_log off; | |
| return 404; | |
| } | |
| location ~ ^/(CHANGELOG\.txt|COPYRIGHT\.txt|INSTALL\.txt|INSTALL\.mysql\.txt|INSTALL\.pgsql\.txt|INSTALL\.sqlite\.txt|LICENSE\.txt|MAINTAINERS\.txt|README\.txt|UPGRADE\.txt) { | |
| access_log off; | |
| return 404; | |
| } | |
| location / { | |
| expires max; | |
| try_files $uri @drupal; | |
| } | |
| location @drupal { | |
| rewrite ^/(.*)$ /index.php; | |
| } | |
| location ~ \.php$ { | |
| error_page 418 = @drupal; | |
| recursive_error_pages on; | |
| fastcgi_split_path_info ^[^=](.+\.php)(/.+)$; | |
| if ( $uri = /index.php ) { | |
| # not sure this conditional works, will have to check the debug logs | |
| break; | |
| } | |
| if ( !-e $document_root$fastcgi_script_name) { | |
| return 418; | |
| } | |
| expires 1m; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| fastcgi_pass unix:/var/run/php5-fpm.sock; | |
| } |
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
| # file sites-enabled/drupal7 | |
| server { | |
| server_name mydomain.fr; | |
| root /var/www/mydomain; | |
| include templates/drupal7; | |
| } |
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
| # file /etc/php5/fpm/pool.d/www.conf | |
| # Search and Set listen value to sock | |
| listen = /var/run/php5-fpm.sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment