First, you need to install the web server, php-related stuff, and the database server (we use PostgreSQL).
1apt-get install -y php5-fpm nginx postgresql php5-pgsql
Now download and install Joomla (currently 3.1.5 is the latest). Please update the following lines with the latest version if necessary:
1cd /srv
2wget https://joomlacode.org/gf/download/frsrelease/18622/83487/Joomla_3.1.5-Stable-Full_Package.zip
3unzip Joomla_3.1.5-Stable-Full_Package.zip -d joomla
4chown -R www-data:www-data joomla
The only two things you need to do are to create a user (joomla in the example) and a database (joomla in the example). To do it under the postgres user:
1sudo -u postgres -i
2createuser joomla --pwprompt --encrypted
3createdb joomla
4exit
Output should look like:
1$ createuser joomla --pwprompt --encrypted
2Enter password for new role:
3Enter it again:
4Shall the new role be a superuser? (y/n) n
5Shall the new role be allowed to create databases? (y/n) y
6Shall the new role be allowed to create more new roles? (y/n) n
Create a file joomla with the content (you may want to adjust server_name and root):
# vim /etc/nginx/sites-available/joomla
server {
listen 80;
server_name joomla.lan;
access_log /var/log/nginx/localhost.access.log;
error_log /var/log/nginx/localhost.error.log;
root /srv/joomla;
index index.php index.html index.htm default.html default.htm;
# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php?$args;
}
# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
}
Enable the site by creating a link to the config:
1ln -s /etc/nginx/sites-available/joomla /etc/nginx/sites-enabled/
And add FastCGI options (create the fastcgi.conf file):
1# vim /etc/nginx/fastcgi.conf
2fastcgi_param QUERY_STRING $query_string;
3fastcgi_param REQUEST_METHOD $request_method;
4fastcgi_param CONTENT_TYPE $content_type;
5fastcgi_param CONTENT_LENGTH $content_length;
6
7fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
8fastcgi_param SCRIPT_NAME $fastcgi_script_name;
9fastcgi_param PATH_INFO $fastcgi_path_info;
10fastcgi_param REQUEST_URI $request_uri;
11fastcgi_param DOCUMENT_URI $document_uri;
12fastcgi_param DOCUMENT_ROOT $document_root;
13fastcgi_param SERVER_PROTOCOL $server_protocol;
14
15fastcgi_param GATEWAY_INTERFACE CGI/1.1;
16fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
17
18fastcgi_param REMOTE_ADDR $remote_addr;
19fastcgi_param REMOTE_PORT $remote_port;
20fastcgi_param SERVER_ADDR $server_addr;
21fastcgi_param SERVER_PORT $server_port;
22fastcgi_param SERVER_NAME $server_name;
23
24fastcgi_param HTTPS $https;
25
26# PHP only, required if PHP was built with --enable-force-cgi-redirect
27fastcgi_param REDIRECT_STATUS 200;
Now you need to point joomla.lan to the 127.0.0.1 IP address. To do it, add a line to /etc/hosts:
127.0.0.1 joomla.lan
Now restart and go to http://joomla.lan.