Drupal 7 - Setup Ubuntu/nginx/sqlite3
- Install nginx
- apt-get install nginx
- /etc/init.d/nginx start
- Install sqlite3
- apt-get install sqlite3 libsqlite3-dev
- Install php5
- apt-get install php5-fpm
-
vim /etc/nginx/sites-available/default (update for php conf)
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6root /usr/share/nginx/www;
index index.php index.html index.htm;server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an error code
#return 418;
#}#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
} - /etc/init.d/nginx restart
- Test with info.php (<?php phpinfo(); ?>)
- Install php extensions for db and gd (needed for drupal)
- apt-get install php5-gd
- apt-get install php5-sqlite
- /etc/init.d/php5-fpm restart
- Install drupal
- apt-get install php-apc
- /etc/init.d/php5-fpm restart
- mkdir -p /var/www/drupal/web
- wget http://ftp.drupal.org/files/projects/drupal-7.x.tar.gz
- tar xvfz drupal-7.x.tar.gz
- cd drupal-7.x/
- mv * /var/www/drupal/web/
- chown -R www-data:www-data /var/www/drupal/web (gives nginx user perms to dir)
- vim /etc/nginx/sites-available/drupal
server {
listen 80;
server_name example.com;
root /var/www/drupal/web;
index index.php index.html;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* .(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(.php)?|xtmpl)$|^(..*|Entries.*|Repository|Root|Tag|Template)$|.php_ {
deny all;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* .(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
location ~ .php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
} - ln -s /etc/nginx/sites-available/drupal /etc/nginx/sites-enabled/drupal (symlink)
- /etc/init.d/nginx restart
- Visit drupal url and complete site config