Creating a PHP VHost under LiteSpeed

Previously I setup the PHP environment and the PHP VHost template, so I can create a PHP VHost in seconds.
Instead of creating an httpd conf for every website, you can just add a website in the admin webinterface of LiteSpeed web server.
Before we do that, we have to setup the skeleton directories for our php site. I mention specifically PHP, because we can also run Ruby sites with LiteSpeed :)

cd ~/public_html
mkdir phpdomain.com
cd phpdomain.com
mkdir log config cgi-bin private public
touch public/index.php

Put something nice in the index.php file, so you see some output when browsing.
Go to PHP_suEXEC of the Virtual Host Templates.

http://your_host:7080/config/confMgr.php?m=tp_PHP_SuEXEC

Since we have already setup the correct settings previously, the only thing we have to do is click on 'Add' in the Member Virtual Hosts area.
Fill in the domain info.

Virtual Host Name phpdomain.com
Domain phpdomain.com
Aliases www.phpdomain.com, phpdomain.yourotherdomain.com

You could leave the domain there but we are going to 'Instantiate' it. This means that it will be an independent Virtual Host so if any changes were made to the PHP template, it would have no effect on our domain. It also means we can tweak and adjust any setting within our Virtual Host and it will not effect anything else.
Before clicking Instantiate, make sure your phpdomain.com/config folder is writable by the group www-data. (chmod g+w config)
So, click 'Instantiate', confirm by clicking 'Yes' and apply changes and gracefully restart the server.

I like to be able to use a subdomain.mpie.nl for my projects, so my customers can reach their website by their sitename as a subdomain .mpie.nl
By setting up 1 A record in the DNS, that points to my VMware machine IP-address, I can create infinite CNAME to the A record and catch it with the alias by LiteSpeed.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.