Update & Upgrade
Timezone change (if you do not need to change timezone, ignore this step)
Adding repository (edit /etc/apt/sources.list and add links to dotdeb repository)
Adding keys for the repository
Update & Upgrade
Nginx & Mysql & Memcached installation
You probably noticed that I use nginx-extras package, you can see comparison between available Nginx packages here.
(all configuration files later in this setup are made for nginx-extras, so if you install other nginx package, some stuff will not work, but you can remove them from suggested nginx configuration)
(all configuration files later in this setup are made for nginx-extras, so if you install other nginx package, some stuff will not work, but you can remove them from suggested nginx configuration)
PHP-FPM & APC installation
Drush installation (v5.9)
(if you want double check which drush version is installed, enter in terminal this line: drush version)
Nginx & PHP-FPM restart
While now is installed all necessary, it's not yet needed to restart, but is not bad to check if default stuff are installed properly without errors.
While now is installed all necessary, it's not yet needed to restart, but is not bad to check if default stuff are installed properly without errors.
PHP-FPM configuration & multiple pool
This PHP5-FPM pool configuration uses three pools, www1, www2 and www3 and unix sockets (defined in upstream_phpcgi_unix.conf). You need to create three pools or alternatively, change upstream_phpcgi_unix.conf to match your existing PHP5-FPM configuration.
This PHP5-FPM pool configuration uses three pools, www1, www2 and www3 and unix sockets (defined in upstream_phpcgi_unix.conf). You need to create three pools or alternatively, change upstream_phpcgi_unix.conf to match your existing PHP5-FPM configuration.
Now we have three pools, and is needed to change in each of this files reference to sockets (each pool require its own socket). Or you can download all three files below and upload them to folder /etc/php5/fpm/pool.d
line 4 - rename www to www1
line 33 - put listen path to: /var/run/php5-fpm-www1.sock
line 33 - put listen path to: /var/run/php5-fpm-www1.sock
line 4 - rename www to www2
line 33 - put listen path to: /var/run/php5-fpm-www2.sock
line 33 - put listen path to: /var/run/php5-fpm-www2.sock
line 4 - rename www to www3
line 33 - put listen path to: /var/run/php5-fpm-www3.sock
line 33 - put listen path to: /var/run/php5-fpm-www3.sock
Nginx configuration for Drupal
1. Remove default nginx configuration (backup)
2. Getting troubleshooter configuration from github
This configuration has several changes from original perusio configuration, and is only for Drupal 7.
Perusio configuration you can use on both 6 and 7 version of Drupal.
This configuration has several changes from original perusio configuration, and is only for Drupal 7.
Perusio configuration you can use on both 6 and 7 version of Drupal.
3. Adjust nginx for your domain
In folder /etc/nginx/sites-available you will find configuration for example.com domain.Rename this file to yourdomain.com.conf
In folder /etc/nginx/sites-available you will find configuration for example.com domain.Rename this file to yourdomain.com.conf
After that you need to change domain name in this file according to your needs. Replace all reference for example.com to yourdomain.com.
Additional, path to root of your site is then /var/www/sites/yourdomain.com, also adjust for your needs. (e.g in my setup all sites are /var/www/mydomain.com)
If you want that server do not listen for IPv6, comment all reference to them. Or if you want that server listens on exact IPv6 address, insert them in nginx config. You can see which IPv6 address have the server with this command:
3. Nginx microcache
Microcaching requires the presence of /var/cache/nginx/microcache directory which don't exist by default. You must create it and grant the appropriate permissions to the Nginx user (in Debian 7 it's www-data)
Microcaching requires the presence of /var/cache/nginx/microcache directory which don't exist by default. You must create it and grant the appropriate permissions to the Nginx user (in Debian 7 it's www-data)
4. Nginx SSL
This Nginx configuration requires SSL (if you do not want SSL, skip this step, but you need then adjust Nginx configuration). Below are instruction for generating self-signed certificate, and location for them are following current Nginx configuration. You can adjust all this for your needs.
This Nginx configuration requires SSL (if you do not want SSL, skip this step, but you need then adjust Nginx configuration). Below are instruction for generating self-signed certificate, and location for them are following current Nginx configuration. You can adjust all this for your needs.
Create directory
Generate key & certificate
Moving key and certificate according to current nginx configuration (or edit location in yourdomain.com.conf)
5. Enabling your site configuration
Final step for Nginx is to create sites-enabled folder, and then create symlinks to sites which you want to enable
Final step for Nginx is to create sites-enabled folder, and then create symlinks to sites which you want to enable
Nginx & PHP-FPM restart
This should be last step, restart PHP-FPM and Nginx.
This should be last step, restart PHP-FPM and Nginx.
If Nginx throw error regarding types_hash, server_names or variables try to uncomment following lines and change values in /etc/nginx/nginx.conf :
variables_hash_max_size 1024; # default 512
variables_hash_bucket_size 64; # default is 64
variables_hash_bucket_size 64; # default is 64
or add these two line
types_hash_bucket_size 2048;
server_names_hash_bucket_size 64;
server_names_hash_bucket_size 64;
Now you should have configured Nginx & PHP-FPM & APC & Memcached and Drush on Debian 7.
Final step is clean Drupal installation or migration of existing website.
Final step is clean Drupal installation or migration of existing website.
WWW directory
By default /var/www directory do not exist, so we need to create them and assign ownership to www-data group
(if you work with www-data group as you should, drush need read/write permission)
By default /var/www directory do not exist, so we need to create them and assign ownership to www-data group
(if you work with www-data group as you should, drush need read/write permission)
Drupal installation (switching to www-data)
Additional configuration
APC - tweak your APC settings with following or adjust as you wish
Memcached
Configuration file is located in etc folder: /etc/memcached.conf.
Probably is good to increase memory pool at least to 128MB (default is 64MB)
Change line 23 from -m 64 to -m 128
Configuration file is located in etc folder: /etc/memcached.conf.
Probably is good to increase memory pool at least to 128MB (default is 64MB)
Change line 23 from -m 64 to -m 128
PHP-FPM & Nginx & Mysql
All further tweaking depends also on your server and Drupal sites. High traffic sites need a lot more tweaking from this. You have some example of configuration for mysql, php-fpm, etc.., but use them with caution.
Install PHP Redis
https://github.com/nicolasff/phpredis
wget https://github.com/nicolasff/phpredis/archive/master.zip
unzip master.zip
cd phpredis-master
phpize
./configure
make && make install
nano /etc/php5/fpm/conf.d/redis.ini
extension=redis.so
/etc/init.d/php5-fpm restart
Sem comentários:
Enviar um comentário