Default Drupal package in Ubuntu installs Apache, but I prefer nginx as a webserver. In this note I’ll describe steps necessary to get Drupal 7 work.
All variables in square brackets must be replaced by your names or passwords.
Site will be available at url [sitename].
Install all necessary packages:
sudo apt-get install -y nginx php5-fpm php-apc php5-mysql mysql-client-core-5.5 mysql-server php5-gd
During the installation MySQL will ask you for root password. Rememer it, I will refer to it as [mysqlpwd] further.
Login to MySQL console:
mysql -u root --password=[mysqlpwd]
and issue the following commands (create user, create database, allow user to work with database):
CREATE USER '[dbuser]'@'localhost' IDENTIFIED BY '[dbpwd]';
CREATE DATABASE [dbname];
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON `[dbname]`.* TO '[dbuser]'@'localhost' IDENTIFIED BY '[dbpwd]';
FLUSH PRIVILEGES;
EXIT
Here we will make a configurational file for nginx.
As create file in sites-available
directory with content:
server {
listen 80;
server_name [sitename];
access_log /var/log/[sitename].access.log;
error_log /var/log/[sitename].error.log;
root /srv/[sitename];
index index.php;
location / {
try_files $uri $uri/ /index.php;
}
location = /favicon.ico {
empty_gif;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
and add link for nginx to enable site:
sudo ln /etc/nginx/sites-available/[sitename] /etc/nginx/sites-enabled/[sitename]
sudo service nginx restart
We will store Drupal in folder in /srv
. Issue following commands in bash:
sudo -s
cd /srv
wget http://ftp.drupal.org/files/projects/drupal-7.22.tar.gz
tar xvf drupal-7.22.tar.gz
mv drupal-7.22 [sitename]
chown -R www-data:www-data [sitename]
exit