This is a simple step by step guide for install Joomla CMS onto a Ubuntu 12.04 server with LEMP stack (Linux Nginx MySQL PHP).

joomla

  1. Update
    • sudo apt-get update
  2. LEMP
    1. Install Nginx
      1. sudo apt-get install nginx
      2. sudo /etc/init.d/nginx start
      3. Test nginx has started by navigating to server url and checking "Welcome to nginx"
    2. Install PHP and plugins
      1. sudo apt-get install php5-cli php5-fpm php5-mysql
      2. Config nginx to work with PHP
        • sudo vim /etc/nginx/sites-available/default
        • In server section
          • change "index index.html index.htm;" to "index index.html index.htm index.php;"
          • Look for the "location ~ .php$ {" block and edit as below:
          • # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        location ~ .php$ {                try_files $uri =404;                fastcgi_split_path_info ^(.+.php)(/.+)$;        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini        #        #       # With php5-cgi alone:                fastcgi_pass 127.0.0.1:9000;                # With php5-fpm:        #       fastcgi_pass unix:/var/run/php5-fpm.sock;                fastcgi_index index.php;                include fastcgi_params;        }
          • sudo service nginx restart
          • sudo vim /usr/share/nginx/www/phpinfo.php
          • <? php phpinfo(); ?>
        • Navigate to server url /phpinfo.php and check php info page appears
    3. Install MySQL
      1. sudo apt-get install mysql-server
      2. Set root password
      3. Optional: Install phpmyadmin
      4. sudo apt-get install phpmyadmin
        1. Select "apache2" for web server to config (doesn't matter)
        2. Select "no" for "configure database with dbconfig-common"
        3. Add the following to  /etc/nginx/sites-available/default below the php section
        • location /phpmyadmin {               root /usr/share/;               index index.php index.html index.htm;               location ~ ^/phpmyadmin/(.+.php)$ {                       try_files $uri =404;                       root /usr/share/;                       fastcgi_pass 127.0.0.1:9000;                       fastcgi_index index.php;                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                       include /etc/nginx/fastcgi_params;               }               location ~* ^/phpmyadmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {                       root /usr/share/;               }        }        location /phpMyAdmin {               rewrite ^/* /phpmyadmin last;        }
      5. sudo vim /etc/php5/fpm/php.ini
        • add line "extension=mysqli.so"
        • uncomment (remove ";") "mysqli.allow_local_infile = On"
      6. sudo /etc/init.d/php5-fpm restart
      7. sudo service nginx restart
      8. Navigate to server url /phpmyadmin to check the admin client is working
  3. Joomla
    1. Download and setup joomla dirs
      1. sudo mkdir -p /var/www/joomla/web (best practise name is domain name rather than joomla)
      2. cd /tmp
      3. wget http://joomlacode.org/gf/download/frsrelease/17410/76012/Joomla_2.5.7-Stable-... (get latest download url from http://www.joomla.org/download.html)
      4. sudo apt-get install unzip
      5. unzip Joomla_2.5.7-Stable-Full_Package.zip 
      6. rm -f Joomla_2.5.7-Stable-Full_Package.zip 
      7. sudo mv * /var/www/joomla/web/
      8. sudo chown -R www-data:www-data /var/www/joomla/web (allow nginx to write joomla files)
    2. Create MySQL DB and user (joomla, joomla_admin/joomla_admin_password)
      1. mysqladmin -u root -p create joomla
      2. mysql -u root -p
      3. GRANT ALL PRIVILEGES ON joomla.* TO 'joomla_admin'@'localhost' IDENTIFIED BY 'joomla_admin_password';
      4. GRANT ALL PRIVILEGES ON joomla.* TO 'joomla_admin'@'localhost.localdomain' IDENTIFIED BY 'joomla_admin_password';
      5. FLUSH PRIVILEGES;
      6. quit;
    3. Make nginx config
      1. sudo vim /etc/nginx/sites-available/joomla
      2. server {       listen 80;       server_name www.example.com example.com;       root /var/www/www.example.com/web;       if ($http_host != "www.example.com") {                 rewrite ^ http://www.example.com$request_uri permanent;       }       index index.php index.html index.htm default.html default.htm;       location = /favicon.ico {                log_not_found off;                access_log off;       }       location = /robots.txt {                allow all;                log_not_found off;                access_log off;       }       # 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;       }       # 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?q=$uri&$args;       }       # caching of files       location ~* .(ico|pdf|flv)$ {                expires 1y;       }       location ~* .(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {                expires 14d;       }       location ~ .php$ {                try_files $uri =404;                include /etc/nginx/fastcgi_params;                fastcgi_pass 127.0.0.1:9000;                fastcgi_index index.php;                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;       }}
      3. sudo ln -s /etc/nginx/sites-available/joomla /etc/nginx/sites-enabled/joomla
      4. sudo /etc/init.d/nginx reload