Using HostingScripts by twohlix

The HostingScripts I’m talking about are on github at Feel free to fork it for your own setup.

Step 1. Download the Code using Git

[csmith@two ~]$ cd /wherever/you/want/the/scripts/to/go/
[csmith@two go]$ git clone

Now you should have a bleeding edge version of my HostingScripts under your current directory/HostingScripts/
You can read the README or just keep reading here.

Step 1b. You Might Have to Change Permissions
Check permissions on the scripts and change them to appropriate permissions.

[csmith@two HostingScripts]$ ls -l
total 16
-rwxrwxr-x 1 csmith csmith  281  Jun  3 16:01 disablewww
-rwxrwxr-x 1 csmith csmith 3190  Jun  3 16:01 enablewww
-rwxrwxr-x 1 csmith csmith  945  Jun  3 16:01 listwww
-rwxrwxr-x 1 csmith csmith  843  Jun  3 16:01 README

Those permissions will let anyone run your scripts, but I’m guessing thats not what you want. You might want to chmod away some of those permissions or add them if they’re missing.

[csmith@two HostingScripts]$ chmod go-x *www

That will remove any executable permissions for everyone and the group. Change up the chmod accordingly: If you needed to add permissions so you can execute it, or your group wants to execute it

[csmith@two HostingScripts]$ chmod ug+x *www

Step 2. Alter the Scripts for Your Setup
I’m going to add a configuration file to the project so you only have to change things in one place, but for now you’ll have to edit some things (maybe).

This script assumes some things:
1. You’re using CentOS’s basic setup with httpd for the webserver (not apache2). Particularly HostGator’s VPS setup. If you’re on a HostGator VPS I’m fairly certain you don’t need to change anything.
2. You’re hosting your own DNS server: named.
3. Your users’ home directories are /home/username

These are all changeable, just bust out your favorite text editor and go to town on the scripts (especially enablewww). I’ll leave it up to you to figure out what you have to change.

Step 3. Enable a Site
Enabling a site is easy. For example if I wanted to enable hosting of in my user I would do this:

[csmith@two HostingScripts]$ ./enablewww csmith

The site should be up and running under ~csmith/www/ and the servable files are in htdocs/. I’ll often create a symlink named htdocs to whatever directory I want. For example this site uses a symlink from htdocs to my wordpress directory. If i want to put the site in a special maintenance mode I could just recreate the htdocs symlink to some other directory and httpd will serve that up instead.

[csmith@two]$ ln -s wordpress htdocs

Step 4. Disable a Site
Disabling a site is fairly easy, although you have to alter the named.conf file if you want to stop the DNS. I plan to add in the changes for that, but not this second.

[csmith@two HostingScripts]$ ./disablewww csmith