Userdir Access On ISPConfig 3 Server

This tutorial describes how you can enable userdir based access on your ISPConfig3 server running apache2.

At the end, your clients will be able to access their site via http://yourdomain.tld/~clientdomain.tld

I do not issue any guarantee that this will work for you!


1 Requirements

To follow this tutorial you will need the following:

  • a working ISPConfig3 server


2 Preparing Apache2

Before we can install the ISPConfig3 plugin, we have to prepare the apache2 webserver. It's very easy.

First of all, you have to enabled the mod_userdir module by typing:

a2enmod userdir

Since we don't want to use the modules default configuration, we simply delete it's content (otherwise usedir access would be possible from all domains):

echo "" > /etc/apache2/mods-available/userdir.conf

However, apache2 now doesn't have a config for userdir anymore, so we add it again.

Open the file /etc/apache2/sites-available/default with an editor of your choice (e.g. nano) and append the following lines within the vhost directive:

<IfModule mod_userdir.c>
	UserDir /var/www/*/web
	UserDir disabled

	Include /etc/apache2/userdirs-enabled/*

	<Directory /var/www/*/web>

		AllowOverride FileInfo AuthConfig Limit Indexes
		Options MultiViews SymLinksIfOwnerMatch IncludesNoExec

			Order allow,deny
			Allow from all

		<LimitExcept GET POST OPTIONS>
			Order deny,allow
			Deny from all

		# Disallow PHP file access
		<Files ~ '.php[s3-6]{0,1}$'>
			Order allow,deny
			Deny from all
			Allow from none


and save the file.

Last but not least we need to create two folders into which the plugin will save it's files (equal to sites-available and sites-enabled):

mkdir /etc/apache2/userdirs-available
mkdir /etc/apache2/userdirs-enabled

Finally, restart apache:

/etc/init.d/apache2 restart


3 Installing The Plugin

Now it's time to install the plugin itself, as for now, userdir doesn't to anything.


Download The Plugin

It's always good to have temporary files within /tmp so go there:

cd /tmp

and download the plugin:


Note that the last part of the URL (e.g *stable*) stands for the branch.
We have *master*, *stable* and *experimental* but you should always take *stable*, as this contains a version that's working fine.

Now, unpack the files by running:

unzip master
rm master


Copy The Files

OK, as you now have all the file on the server's disk, it's time to copy them to the correct paths. Therefore we first change into the newly created folder:

cd Rackster-ispconfig3-userdir-*

and copy the files:

cp usr/local/ispconfig/server/plugins-available/ /usr/local/ispconfig/server/plugins-available/
cp usr/local/ispconfig/server/conf/apache2_userdir.conf.master /usr/local/ispconfig/server/conf/

Do the same for all files within the interface folder. You may need to delete existing files first.

If your setup is already modified, it might be smart to manually apply the changes. To do so, just take a loot at to see what files were changed.

Done! We no longer need the downloaded files, so we can delete them:

rm -rf /tmp/Rackster-ispconfig3-userdir-*

However, the plugin uses a class which was taken from another plugin, so you have to create a folder and file for it to work:

mkdir /usr/local/ispconfig/server/plugins-available/classes

and create a file called vhost.php within this folder:

nano /usr/local/ispconfig/server/plugins-available/classes/vhost.php

and paste the content of this file into it:


Add The DB Field

The plugin needs another field in the ISPConfig Database, you have to create it. The easiest way is to login into phpMyAdmin:

select ISPConfig DB -> select table web_domain -> add new field after "errordocs" -> name: userdir, type: tinyint, length: 1, default: 0

CHMOD The Files

Just run:

chmod 750 /usr/local/ispconfig/server/conf/apache2_userdir.conf.master
chmod 750 /usr/local/ispconfig/server/plugins-available/

to set correct rights.


Enable The Plugin

ISPConfig looks in /usr/local/ispconfig/server/plugins-enabled for enabled plugins, so we have to create a symlink there:

cd /usr/local/ispconfig/server/plugins-enabled/
ln -s /usr/local/ispconfig/server/plugins-available/

That's all!


4 Using The Plugin

If you followed all steps from above, you should now see another "field" called Temporary URL within the sites module. To enable userdir based access for a domain, just activate the checkbox next to it.

The client will then be able to access his site by typing: http://yourdomain.tld/~hisdomain.tld in the browser.


5 Notes

  • For security reasons, PHP is completely disabled when accessing a site via its userdir URL.
  • This might only be useful for sites using HTML/CSS/JS only.
  • Make sure to check out the repository on GitHub from time to time to check if there were additional changes.


Share this page:

Suggested articles

7 Comment(s)

Add comment


By: Szymon


Is possible enable executing php scripts in userdir?


I's possible by commenting the apache directive disallowing access to files ending with .php* - it's however not recommended.

By: ally

Is it possible to do this with nginx + ispconfig3 +centos?

By: ally

(Going to answer the question I posted previously)

 This also works for nginx + IspConfig3 + CentOs6.3.  If on nginx, skip all the apache parts and do this  (changing the "/home/$1/public_html$2;" part to whatever is your dir structure). Then proceed to install the plugin as directed, except I used the source link from github page to download the plugin as the link posted here no longer works.

 Also, what worked for me is  (specifying page you want to see else you get a forbidden error even if you turn autoindex on).

By: Anonymous


 I would like to set the user_dir module in my server via this method, but the file deosn't seem to be available.

Does anypne still have the file and the plugin?

Thank you


By: seb

 The link is nok now ...


We don't can do it :-(

By: DonMRo

Can we get the addon vhost.php file contents pasted here????