You need install and configure Nginx first.
sudo apt-get update
sudo apt-get install nginx
Add below to /etc/nginx/sites-enabled/yourdomain.conf, replacing webhosting.com with yourdomain.conf
server {
listen *:80;
server_name webhosting.com www.webhosting.com;# Define default caching of 24h
expires 86400s;
add_header Pragma public;
add_header Cache-Control “max-age=86400, public, must-revalidate, proxy-revalidate”;# deliver a static 404
error_page 404 /404.html;
location /404.html {
internal;
}# Deliver 404 instead of 403 “Forbidden”
error_page 403 = 404;# Do not allow access to files giving away your WordPress version
location ~ /(\.|wp-config.php|readme.html|licence.txt) {
return 404;
}# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;# Don’t log robots.txt requests
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}# Rewrite for versioned CSS+JS via filemtime
location ~* ^.+\.(css|js)$ {
rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
expires 31536000s;
access_log off;
log_not_found off;
add_header Pragma public;
add_header Cache-Control “max-age=31536000, public”;
}# Aggressive caching for static files
# If you alter static files often, please use
# add_header Cache-Control “max-age=31536000, public, must-revalidate, proxy-revalidate”;
#location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|
#gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|
#mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|
#ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|
#wri|xla|xls|xlsx|xlt|xlw|zip)$ {
# expires 31536000s;
# access_log off;
# log_not_found off;
#add_header Pragma public;
#add_header Cache-Control “max-age=31536000, public”;
#}
error_log /var/log/nginx/webhosting.com-error.log;
access_log /var/log/nginx/webhosting.com-access.log;root /home/wordpress-user/webhosting.com;
location / {
index index.php index.html index.htm;
}# get friendly url links working
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}# pass all PHP files through php-fpm
location ~ \.php$ {try_files $uri =404;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/wordpress-user/webhosting.com$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}# deny all apache .htaccess or .htpasswd files
location ~ /\.ht
{
deny all;
}
# Deny access to hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
Now you need to reset the Nginx service.
sudo service nginx restart
Now we need to install PHP, PHP-FPM, PHP-GN and PHP MySQL drivers. PHP-GD is for image cropping and rotating to work.
sudo apt get install php5-fpm php5 php5-mysql php5-gd
Next configure PHP-FPM to serve your website.
cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/yourdomain.conf
Add user, Modify the following parameters in /etc/php5/fpm/pool.d/yourdomain.conf
useradd -s /sbin/nologin usern@me
vim /etc/php5/fpm/pool.d/yoursite.conf; Add a pool name to identify your site’.
[wordpress];Modify the port for PHP-FPM to listen on
listen = 127.0.0.1:9001;Add the user we created earlier
user = usern@me
group = usern@me
You should restart PHP-FPM
sudo service php-fpm restart
Installing MariaDB adding it’s repository
sudo apt-get install software-properties-common
sudo apt-key adv –recv-keys –keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository ‘deb [arch=amd64,i386] http://mirror.fibergrid.in/mariadbrepo/10.1/ubuntu trusty main’
sudo apt-get update
sudo apt-get install mariadb-server
Set a root password database server. Once set login and create a wordpress user and database.
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpress-user@localhost IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress-user@localhost;
FLUSH PRIVILEGES;
exit
You are set to download and Install WordPress now.
cd /tmp
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo mv wordpress /home/usern@me/
sudo chown -R usern@me:usern@me /home/usern@me/wordpress
Done, you should be able to browse WordPress site on yourdoamin.com (Replace yourdomain.com with your domain name.)
Source and Referencing : https://github.com/Leo-G/