Product SiteDocumentation Site

5. Drupal

5.1.  Install Drupal 7

yum install drupal7
create settings.php
cp /etc/drupal7/default/default.settings.php /etc/drupal7/default/settings.php
set rights settings.php
chmod 777 /etc/drupal7/default/settings.php
make /files writeable
chmod 777 /etc/drupal7/default/files/
create user and database
createdb -U <adminuser> -e -O <adminuser> drupal7
Create /etc/nginx/conf.d/drupal7.conf
server {
        server_name your.server.name;
        root /usr/share/drupal7; 

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        # This matters if you use drush
        location = /backup {
                deny all;
        }

        # Very rarely should these ever be accessed outside of your lan
        location ~* \.(txt|log)$ {
                allow 192.168.0.0/16;
                deny all;
        }

        location ~ \..*/.*\.php$ {
                return 403;
        }

        location / {
                # This is cool because no php is touched for static content
                try_files $uri @rewrite;
        }

        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 @rewrite {
                # Drupal in a subdirectory
                rewrite ^/([^/]*)/(.*)(/?)$ /$1/index.php?q=$2&$args;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                #fastcgi_pass unix:/tmp/phpfpm.sock;
                fastcgi_pass 127.0.0.1:9000;
        }

        # Fighting with ImageCache? This little gem is amazing.
        location ~ ^/sites/.*/files/imagecache/ {
                try_files $uri @rewrite;
        }
        # Catch image styles for D7 too.
        location ~ ^/sites/.*/files/styles/ {
                try_files $uri @rewrite;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico) {
                expires max;
                log_not_found off;
        }
}
Restart nginx
systemctl restart nginx.service

Setup Drupal 7

goto http://your.server.name/ and follow the instructions, choice for DB Postgresql

Enable Clean URLs

  1. Navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata)
  2. Wait for the automated Clean URLs test to run.
  3. Check or uncheck the Enable clean URLs checkbox
  4. Click 'Save configuration'