Created
July 2, 2013 05:04
-
-
Save dmouse/5906891 to your computer and use it in GitHub Desktop.
Nginx config fiel for Virtualhost 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
| server { | |
| listen 80; | |
| server_name wawa.com www.wawa.com; | |
| server_tokens off; | |
| aio off; | |
| directio off; | |
| sendfile on; | |
| gzip on; | |
| proxy_read_timeout 900s; | |
| fastcgi_read_timeout 900s; | |
| location /nginx_ping { | |
| return 204; | |
| } | |
| # No reading git files | |
| location ~ /\.git { | |
| deny all; | |
| } | |
| # Original formula Drupal code protection as per .htaccess | |
| location ~ \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$ { | |
| return 403; | |
| } | |
| # No reading git files | |
| location ~ /\.git { | |
| deny all; | |
| } | |
| # Original formula Drupal code protection as per .htaccess | |
| location ~ \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$ { | |
| return 403; | |
| } | |
| # Protect /private (for private code) | |
| location ~ ^/private/ { | |
| return 403; | |
| } | |
| # Protect /sites/default/files/private (for private files) | |
| location ~ ^/sites/default/files/private/ { | |
| return 403; | |
| } | |
| # Protect /sites/default/config (for configuration) | |
| location ~ ^/sites/default/config/ { | |
| return 403; | |
| } | |
| location ~ /sites/default/files/.*\.php$ { | |
| return 403; | |
| } | |
| location ~ ^/robots.txt { | |
| add_header Cache-Control max-age=86000; | |
| } | |
| client_max_body_size 10M; | |
| access_log /var/log/nginx/wawa.com_access.log; | |
| error_log /var/log/nginx/wawa.com_error.log; | |
| location / { | |
| root /var/www/httpdocs; | |
| index index.php; | |
| try_files $uri $uri/ @rewrite; | |
| expires max; | |
| } | |
| location @rewrite { | |
| # Some modules enforce no slash (/) at the end of the URL | |
| # Else this rewrite block wouldn't be needed (GlobalRedirect) | |
| rewrite ^/(.*)$ /index.php?q=$1; | |
| } | |
| location ~ \.php$ { | |
| root /var/www/httpdocs; | |
| #try_files $uri =404; | |
| fastcgi_pass 127.0.0.1:9000; | |
| fastcgi_read_timeout 120; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment