Linux Tutorial – How To Host Your Website On Linux

Today I am going to show you on “How to host your website on Linux VPS (WordPress).”

Image result for Host Website On Linux cpanel


The reason why we are going to host your website on Linux VPS is because they have more stability and reliability for basic web hosting needs, more control compared to shared hosting, cost effective solutions for small website, assured 99.95% uptime (depends upon your VPS providers) and lot of features.

Buying a VPS from RamNode:

We need to choose a Linux VPS depending upon the traffic your website gonna receive. Here is the link where I brought my VPS from:

  • Income Traffic 0-750 views/day: Plan 1
  • Income Traffic 750-2k views/day: Plan 2
  • Income Traffic 2k-5k views/day: Plan 3
  • Income Traffic 5k+ views/day: I request you to switch VPS provider since I don’t recommend RamNode VPS for more than 5k views/day, reason is they only provide 1GB connection speed.

plan selection

After few minutes you will receive the VPS details.


After buying a VPS continue the steps given below. If you have any doubts do not hesitate to comment below or if you already got a VPS then just follow the steps. WordPress will be my Control Management System to access the website.

Buying a domain and configure it:

You can buy a domain from or any place where you like to

After getting it, in DNS management you have to change type to “A” and enter the domain name and the VPS IP



By changing DNS settings it will allow your domain to point to your VPS Server.

Setting up VPS:

Goto URL: and install Debian 7 32-bit”. It will only take few minutes.

Download Putty and run it. Add your VPS IP and connect to your VPS though Putty. After that enter “username” and “password“.

Enter the following commands in the give order:

1. Update and update debian:


  1. apt-get update
  2. apt-get upgrade

2. Install nginx, php5 and mysql:


  1. apt-get install nginx php5-fpm mysql-server


3. Download WordPress CMS: (replace with your website name)


  1. cd /var/www/
  2. mkdir
  3. cd
  4. wget
  5. tar vxzf latest.tar.gz
  6. rm latest.tar.gz


4. Configuring mysql


  1. mysql -u root –p (press enter and then it will ask you to enter the password for mysql which you used when you install mysql-server)


5. Creating database and granting access to it:


  1. create database example; (replace example with any name you wish)
  2. grant select, delete, create, alter, update, drop, insert, index on example.* to ‘example’@’localhost’ identified by ‘Enteranypasswordwhichyouwanthere’; (Once done press enter and then ctrl + c to exit)


6. Changing WordPress config.php file:


  1. cd /var/www/
  2. cp wp-config-smaple.php wp-config.php
  3. vim wp-config.php (after opening the file, change your database details and save it)


7. Setting up nginx file:


  1. cd~
  2. cd /etc/nginx/sites-available/
  3. vi (rename with your domain name)


Now press “Insert” button and type the following command:


  1. server {
  2. listen 80;
  3. root /var/www/;
  4. index index.php index.html index.htm;
  5. server_name;
  6. location / {
  7. try_files $uri $uri/ /index.php?q=$uri&$args;
  8. }
  9. error_page 404 /404.html;
  10. error_page 500 502 503 504 /50x.html;
  11. location = /50x.html {
  12. root /usr/share/nginx/www;
  13. }
  14. location ~ \.php$ {
  15. try_files $uri =404;
  16. fastcgi_pass unix:/var/run/php5-fpm.sock;
  17. fastcgi_index index.php;
  18. include fastcgi_params;
  19. }
  20. }


Note: Change server_name with your domain name and root /var/www/ with your domain name or the folder name that you gonna use.

Once done save the file, press ESC + : + x (to save and exit)

8. Enabling the vhost file:


  1. cd ..
  2. cd sites-enabled/
  3. ln -s /etc/nginx/sites-available/


Everything is done now. Just type “service nginx restart” and visit your domain now. It should be working fine.

Note: Make sure you change “” to your domain name in each place that I have mentioned “

If you want to upload any file to your server then use “FileZilla Client” as file manager by connecting to your server using IP , USERNAME, PASSWORD and PORT

Here is a video that we have made for you on hosting a website on Linux serverwithout cPanel


Leave a Reply

Your email address will not be published. Required fields are marked *