Install the LEMP stack(Linux, Nginx, Mysql, PHP) with the command below:
sudo apt-get install nginx mysql-server php5-fpm php5-mysql
Note: Please set the MySQL root password, when it will prompt for it during the installation of MySQL-Server. Secure the PHP by editing the php.ini file:
sudo vi /etc/php5/fpm/php.ini
Uncomment the cgi.fix_pathinfo and change it from 1 to 0:
cgi.fix_pathinfo=0
Create the new virtual host for wordpress (In my case, I have named it tendosite):
sudo vi /etc/nginx/sites-available/tendosite
Add the following code to the virtual host file (change these parameters that are marked with blue colour):
server {
listen 80;
server_name rbgeek.com;
root /var/www/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
}
Enable the virtual host by creating it’s link inside the /etc/nginx/sites-enabled:
sudo ln -s /etc/nginx/sites-available/tendosite /etc/nginx/sites-enabled/tendosite
Change the permission and owner of php5-fpm.sock by editing the /etc/php5/fpm/pool.d/www.conf file:
sudo vi /etc/php5/fpm/pool.d/www.conf
Remove the comment for listen.mode, .group and .owner:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
To start the MySQL command-line client, use this command:
mysql -u root -p
Create a wordpress database and granting all privileges to the wordpress user on that database:
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Note: In this tutorial, wpuser will be used for wordpress. Download the latest version of wordpress:
wget http://wordpress.org/latest.tar.gz
Use this command to unpack the WordPress files:
tar -zxvf latest.tar.gz
Move to the extracted wordpress directory and change the name of the config file from wp-config-sample.php to wp-config.php and then edit the wp-config.php file:
cd wordpress/
mv wp-config-sample.php wp-config.php
vi wp-config.php
Insert your MySQL settings that you have created for wordpress:
Create the wordpress directory inside www and move all the wordpress file to it:
sudo mkdir -p /var/www/wordpress
sudo cp -r * /var/www/wordpress/
Change the ownership of /var/www/wordpress directory to www-data:
sudo chown -R www-data. /var/www/wordpress
Move to the /var/www/wordpress/ directory and check the permission:
cd /var/www/wordpress/
ls -l
Restart the nginx service:
sudo service nginx restart
Finally restart the php5-fpm service:
sudo service php5-fpm restart
Open up the browser and go to http://hostname/wp-admin/install.php to begin configuring WordPress:
http://rbgeek.com/wp-admin/install.php
Login to the admin section:
Congratulations!
Hope this will help you! Please Remember me in your prayers! Enjoy
Like this:
Like Loading...
Related
thank you so much. confirmed it works perfectly fine, though I would like to ask you if it is possible to implement (and how would I go about it?) some optimizations to this set-up as I’ve done it on my lemp set-up in my centos vps using the guide at http://www.rosehosting.com/blog/run-wordpress-w3totalcache-with-lemp-nginx-php-fpmapc-and-mysql-stack-on-centos-6-vps-for-maximum-performance/
I’m not that techie to try to implement those improvements and if I try I’m afraid I’ll break my current LEMP set-up on my ubuntu 14.04 vps.
thanks again
thank you very much. worked like charm!
Pingback: Installing the WordPress on Ubuntu using Ansible | Lazy Geek -:)
Many thanks for the quick tutorial it is easy to setup on single try.