Virtual Domain Creation Code

Most people serve more than one domain on their Cloud Server. Whether for different domain names or different subdomains of the same domain, the procedure is the same.

Our Linux Cloud Servers are built from a minimal installation image, meaning there are no additional applications installed beyond the base Operating System.

To begin using your server, you initiate an SSH session to remotely connect to the Cloud Server. In order to make it more useful, you are responsible for installing applications. This can be done by compiling a program from the source code, or more commonly using the Package Manager to install an application from a repository.

The most common application installed is a web server, such as Apache or Nginx.

In order to serve a website you must set up the rest of the framework to serve your content, and then upload the actual content to your server. This entails installing any databases or Content Management Systems your site requires. For networking, you will need to add appropriate DNS records in the Rackspace Cloud control panel, to let the DNS system and the rest of the Internet know that your site is hosted from a Rackspace Cloud IP address.

Finally, you come to the part that allows your Cloud Server to deliver your websites, and for this you will need to create your sites as virtual hosts within your webserver configuration.

NameVirtualHost *:80

ServerAdmin postmaster@sampledrupal
DocumentRoot c:/wamp/www/sampledrupal/htdocs
ServerName sampledrupal
ErrorLog c:/wamp/www/sampledrupal/logs/error_log
DirectoryIndex index.php index.htm index.html

RewriteEngine on
# Rewrite current-style URLs of the form ‘index.php?q=x’.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Was this article helpful?