Tricks & How To's

How to Host your website by creating a Linux Server

Alright here is the method, on how to host your website on Linux server (vps). Since these days you can see hosting a website is costly ,so for this you can host your website on Linux server at low cost and with better bandwidth where it can hold a lot of traffic than shared hosting

I have used Debain (wheezy 7.0), nginx, php5 and mysql. Now follow the instructions as given on your Linux server.

Enter the following commands in the given order

  • apt-get update
  • apt-get upgrade
  • apt-get install nginx php5-fpm mysql-server
  • cd /var/www/
  • mkdir 8bits.tv(replace 8bits.tv with your website name)
  • cd 8bits.tv
  • wget http://www.wordpress.org/latest.tar.gz
  • tar vxzf latest.tar.gz
  • rm latest.tar.gz
  • cd
  • 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)
  • create database 8bit; (replace 8bit with your own name)
  • grant select, delete, create, alter, update, drop, insert, index on 8bit.* to ‘bit’@’localhost’ identified by ‘Enteranypasswordwhichyouwanthere’; (Once done press enter and then ctrl + c to exit)
  • cd /var/www/8bits.tv/wordpress
  • cp wp-config-smaple.php wp-config.php
  • vim wp-config.php (after opening the file change your database details and save it)
  • cd /etc/nginx/sites-available/
  • vim 8bits.tv.vhost (rename 8bits.tv with your website name)

NOW ENTER THIS CODE IN 8bits.tv.vhost AND YOU NEED TO REPLACE 8bits.tv FOLDER WITH YOUR FOLDER AND server_name

server {
listen 80;
root /var/www/8bits.tv/wordpress;
index index.php index.html index.htm;

server_name 8bits.tv www.8bits.tv;

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/www;
}

location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

ONCE DONE SAVE IT AND ENTER THIS FOLLOWING CODE

  • cd ..
  • cd sites-enabled/
  • ln -s /etc/nginx/sites-avialable/8bits.tv.vhost
  • service nginx restart

So once you have done all the above steps , you now have a working web host ? If you have any problems then comment below.

To Top

Pin It on Pinterest

Share This