Tuesday, July 3, 2012

How to Setup a Website on your Free VPS

First, get your free VPS from Host1Free. For some more info on how I setup my Wordpress blog using Centos 5 and Kloxo, click here. This post is about setting up a simple website using Centos 6 and XAMPP.

# wget http://www.apachefriends.org/download.php?xampp-linux-1.7.7.tar.gz
# tar xvfz xampp-linux-1.7.7.tar.gz -C /opt
# vi /opt/lampp/etc/extra/httpd-xampp.conf

Remove the following:

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
81.196.40.94/32
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

# service httpd stop

If you have a domain name for your website, 

# vi /opt/lampp/etc/httpd.conf

Add

NameVirtualHost [your_VPS_IP]:80
NameVirtualHost [your_VPS_IP]:443

<VirtualHost [your_VPS_IP]:80>
    DocumentRoot /opt/lampp/htdocs/yourdomain.com/
    ServerName yourdomain.com
    ServerAlias yourdomain.com
    ErrorLog logs/yourdomain .com-error_log
    CustomLog logs/yourdomain .com-access_log common
    ErrorDocument 404 /opt/lampp/htdocs/path/to/my/404.shtml
</VirtualHost>

# /opt/lampp/lampp start
# /opt/lampp/lampp security

No comments:

Post a Comment