How to setup your first VPS – linode – PART 2

So we’ve setup our server, it is up to date, and root login has been disabled. Now to setup our webserver:

yum install httpd

We’ll assume you’ll be hosting more than one site so will be using Virtual Hosts, lets keep all the V-Host files in one file to make editting websites later on easier.

Lets edit the Vhost file

nano /etc/httpd/conf.d/vhost.conf


ServerAdmin [email protected]
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /srv/www/domain.com/public_html/
ErrorLog /srv/www/domain.com/logs/error.log
CustomLog /srv/www/domain.com/logs/access.log combined

Replace domain.com with your domain name, and insert your email address in the ServerAdmin section.

Now add in your domain web directories

mkdir -p /srv/www/domain.com/public_html
mkdir -p /srv/www/domain.com/logs

now lets start up the web server!

/etc/init.d/httpd start
/sbin/chkconfig --levels 235 httpd on

If all has gone well you should see the green OK box come up. To check that its worked, open up your browser and paste in the IP address, (of course make sure there is a html file in there!) and your web server should be alive!

Mysql install, execute the following commands and follow the prompts

yum install mysql-server
/sbin/chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysql_secure_installation

PHP Install

yum install php php-pear
yum install php-mysql

Restart Apache to activate PHP

/etc/init.d/httpd restart

Check that php has been installed successfully edit a file like this

nano phpinfo.php

and insert


Open your browser and navigate to this file http://youripaddress/phpinfo.php you should see something like this

phpinfo

phpinfo

Comments are closed.