Here is step by step guide to install WordPress on HP Cloud with one Database Server and one Web server on Ubuntu and Nginx PHP5-FPM platform. There are some differences with the other kind of Public Cloud instances and HP Helion Public Cloud. We are writing about HP Helion Public Cloud, by the way; HP Cloud is not exactly the right word. You must read out previous guides – Router and Subnet Settings on HP Cloud and HP Cloud FTP/SFTP Setup, to make sure that the setup are right and publicly available.
Install WordPress on HP Cloud (Ubuntu, Nginx) : Basics
Two server configuration is considered to be difficult setup, yet this is the right setup for proper scaling. You will select Ubuntu latest LTS partner image while creating the instances (which is 14.04 at the time of writing). You can connect with the database server using the internal IP which looks like 10.0.0.x
. You can disassociate the Floating IP to the database server instance when you do not need to SSH. This will ensure strict security.
Install WordPress on HP Cloud : Create Database Server
SSH to the instance with allotted and associated floating IP :
---
1 2 3 | cd /path/to/hp-cloud/pem-file ssh -i your-downloaded-key.pem ubuntu@your-IP # change your-downloaded-key.pem and your-IP |
Get sudo privilege and cd to /root
:
1 2 3 4 | sudo su # or # sudo su - cd /root |
It will throw error as domain name is not set, but it will not matter. Update and upgrade :
1 2 3 4 5 6 | apt-get update -y && apt-get upgrade -y apt-get dist-upgrade -y ## optionally reboot the instance # reboot ## login again and run # sudo su && cd /root |
Only install MySQL server :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | apt-get install mysql-server # you will be prompted for providing a password # edit the /etc/mysql/my.cnf file to configure the basic settings #like log file, port number, etc. # For example, to configure MySQL to listen for connections from internal network, change the #bind-address directive to the server's IP address: nano /etc/mysql/my.cnf # change ip bind-address = 10.0.0.x # change the x # guides on # https://help.ubuntu.com/12.04/serverguide/mysql.html # advanced http://dev.mysql.com/doc/refman/5.0/en/multiple-servers.html # Edit to use innodb engine by default ## ^ + O writes the file, ^ + X exits # restart mysql service mysql restart |
We need to create a database and an user :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | mysql -u root -p # MySQL Welcome message will appear with " > " # ' and ™ are not same, you should use ' # you should manually correct our basic example # take that 10.0.0.1 is the database server CREATE USER 'abhishekghosh'@'10.0.0.2' IDENTIFIED BY 'put-password-here'; # take that 10.0.0.2 is the web server CREATE USER 'abhishekghosh'@'10.0.0.1' IDENTIFIED BY 'put-password-here'; # abhishekghosh is database user GRANT SELECT,DELETE,INSERT,UPDATE ON wordpress.* TO 'abhishekghosh'@'10.0.0.2'; # wordpress is the database name GRANT SELECT,DELETE,INSERT,UPDATE ON wordpress.* TO 'ahishekghosh'@'10.0.0.1'; GRANT ALL PRIVILEGES ON wordpress.* TO 'abhishekghosh'@'10.0.0.2'; FLUSH PRIVILEGES; show databases; # you will see the table with wordpress named database # there can be typographical error in our example due to # forced chanced of ' and ™ # correct the things before running the command # exit from mysql and ssh exit exit |
People installs PHPMyAdmin for this small works. No need.
Install WordPress on HP Cloud : Create Web Server
Rinse, wash, rinse and repeat! SSH to the instance with allotted and associated floating IP :
1 2 3 | cd /path/to/hp-cloud/pem-file ssh -i your-downloaded-key.pem ubuntu@your-IP # change your-downloaded-key.pem and your-IP |
Get sudo privilege and cd to /root
:
1 2 3 4 | sudo su # or # sudo su - cd /root |
It will throw error as domain name is not set, but it will not matter. Update and upgrade :
1 2 3 4 5 6 | apt-get update -y && apt-get upgrade -y apt-get dist-upgrade -y ## optionally reboot the instance # reboot ## login again and run # sudo su && cd /root |
1 | netstat -natu |
If port 80 is not listening, nginx can not open it. Simple. On HP Cloud, OS software based firewall is not much of importance. You can control from one level up. Build an Instance with Ubuntu 14.04 LTS AMD64 Partner Image. 4 GB is great, you can use 2 GB for lesser traffic. Practically, more the number of cores, nginx works more better plus xcache works faster with more RAM.
SSH to the instance. You are not root user, initially using sudo
once, do not disturb the installation process. Yet, we are providing the commands with sudo. First, fully update the instance :
1 2 3 4 | sudo apt-get update -y && sudo apt-get upgrade # check if there is anything suspicious, if not great # proceed. These lines with # are not commands sudo apt-get dist-upgrade -y |
We will run WordPress. Run these :
1 2 3 | sudo apt-get install python-software-properties # if it ask something, accept it apt-get install php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-cli php5-fpm php-pear php5-dev php5-imap php5-mcrypt |
Run auto-remove
to get rid off stuffs not needed :
1 | sudo apt-get autoremove |
Install Nginx :
1 2 3 4 | sudo add-apt-repository ppa:nginx/stable # accept anything if asked sudo apt-get update -y sudo apt-get install nginx |
Reboot the instance once as we have upgraded lot of stuffs :
1 | sudo reboot |
Again SSH to the instance. Install these things :
1 | apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache |
Yeah, php5-curl
and php5-gd
are repeats. Running commands twice will not harm. php5-fpm
has installed, still we will run :
1 | sudo apt-get install php5-fpm php5-gd libssh2-php mysql-client |
We want a separate database server, so only mysql-client
for testing connection like work. Open your IP address and default Debian Nginx webpage will show up. Run this command :
1 | php -v |
If you are facing lot of errors like :
1 2 3 | Cannot adopt OID in UCD-SNMP-MIB: ucdShutdown ::= { ucdTraps 2 } Cannot adopt OID in UCD-SNMP-MIB: ucdStart ::= { ucdTraps 1 } Cannot adopt OID in LM-SENSORS-MIB: lmMiscSensorsTable ::= { lmSensors 5 } |
then you need to install :
1 | sudo apt-get install snmp |
Run :
1 | php -v |
You’ll get a clean output like :
1 2 3 4 5 6 7 8 | PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with XCache v3.1.0, Copyright (c) 2005-2013, by mOo with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo |
snmp
should get installed but basically it does not get installed in expected way; it depends on vendor, so we install it later.
The funny part is that, on HP cloud, the Ubuntu distribution has the public directory at /var/www/html
not at /usr/share/nginx/html
. Make sure where is your public directory by opening the nginx host file :
1 2 3 4 5 | nano /etc/nginx/sites-available/default # check where is directory # add index.php among the index files # you can tweak php5-fpm later by uncommenting # or reading the doc |
Basically your /etc/nginx/sites-available/default
file should look like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; # do not edit root location, this is example root /usr/share/nginx/html; index index.php index.html index.htm; # Make site accessible from http://localhost/ # use a full domain name server_name localhost; location / { # only uncomment, test by adding # /index.php?q=$uri&$args # later try_files $uri $uri/ /index.php; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } |
Open php.ini
file :
1 2 3 4 5 6 7 | nano /etc/php5/fpm/php.ini # find the string # cgi.fix_pathinfo= # with ^ + W # uncomment it # value will be 0 # save the file |
Create this directory and chown it :
1 2 | mkdir -p /spool/nginx/client_temp sudo chown root:www-data /spool/nginx/client_temp -R |
You will require this for our other guides on Nginx and PHP5-FPM. Run these now :
1 2 3 4 5 6 | service php5-fpm restart # if you got stuck with no service named php5-fpm # then go here # https://github.com/AbhishekGhosh/Nginx-PHP5-FPM-Restart-Fix-on-Ubuntu # thats my fix nginx -t && service nginx restart |
1 2 3 4 5 6 | Now, go to html directory : cd /usr/share/nginx/html/ or cd /var/www/html # be sure from nginx that file |
Download WordPress and untar :
1 2 3 4 5 6 | wget http://wordpress.org/latest.tar.gz tar -xzvf latest.tar.gz cd wordpress mv * .. && cd .. rm -r wordpress latest.tar.gz && ls # see the files |
Now, at this point, you should do the DNS server work. Go to HP Helion Public Cloud DNS and add domain which you want. Add A record with the TTL value of 300 with the instance’s floating IP. There will be six name servers. Go to your domain resister’s control panel and add those six DNS. Go to webpagetest.org
and test your domain name after 5 mins. It should show the WordPress installation page. On a different browser, open the domain name and continue the setup for WordPress. You will use the internal IP like 10.0.0.1
for the database server name. You will be prompted to copy a file and create it. Copy it and run these from terminal :
1 2 3 4 5 6 | nano wp-config.php # paste the stuffs # write out # ^ + O # exit # ^ + X |
Continue setup on the browser. This is a secured setup. If you add this line in wp-config.php
:
1 | define('FS_METHOD','direct'); |
You ideally should not have problem with plugins, themes and uploads. Only if you need to fix cannot upload media via WordPress uploader or update Plugins, then you should chown.
Next are advanced guides to tweak PHP5-FPM, tweak Nginx etc. – if you perform a search on our website, you will get all the guides. We have guide on XCache with W3 Total Cache Plugin too. We have not linked because this guide is a basic setup. With 2 x 2 GB server instances, after WordPress installation, you’ll get your site loading within 1.6 seconds on webpagetest.org
without any tweak, cache plugin, CDN. If you increase the TTL of A value to 50 years, around 280 ms will get decreased. 6 name servers are unique about HP Cloud. You’ll never get more than a number of websites on one set of name servers. Rackspace has only two name servers. HP Cloud is far better than Rackspace in terms of performance and infrastructure level support. Hardware is HP Blade Servers.
If you can not install yourself, you can ask us, for a payment. When we will make the partnership with HP public, you do not have to bother about the backend.
Tagged With wordpress nginx