Feb 02 2010

Plesk 9: Adding a subdomain pointing to custom folder (for example, inside webroot)

Category: MiscellaneousFractalizeR @ 4:31 pm

Usually, I work with CPanel. But some time ago my friend asked me to move his website to a server with Plesk installed by default. Website required domain sub.domain.com to point to a folder inside main site webroot. I surprizingly found, that with Plesk 9 it is impossible (it was ok with old versions where Plesk allowed to choose subdomain destination folder). I had to find a way to overcome that.

It is easy. But you need to be root for that.

Open /var/www/vhosts/domain.com/subdomains/sub/conf/vhost.conf in editor.

Add to it the following contents (for sub.domain.com):

DocumentRoot /var/www/vhosts/domain.com/httpdocs/sub
<Directory /var/www/vhosts/domain.com/httpdocs/sub>
	<IfModule sapi_apache2.c>
		php_admin_flag engine on
                php_admin_flag safe_mode off
                php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
                php_admin_flag engine on
                php_admin_flag safe_mode off
                 php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp"
        </IfModule>
        Options -Includes -ExecCGI
</Directory>

 

After that you need to reconfigure Plesk by using command

/usr/local/psa/admin/bin/websrvmng -a

That will do.

Tags:

14 Responses to “Plesk 9: Adding a subdomain pointing to custom folder (for example, inside webroot)”

  1. google.com/profiles/di… says:

    Hi, great post!! :)
    Very helpful.

    By any reason, do you know if this works on version 9.5? I can’t find the vhost.conf

    Cheers,
    Diogo

  2. FractalizeR says:

    It should work. Just create the file.

  3. JDub says:

    This is just what I was looking for – I’ve created and saved the file, but it hasn’t made any difference. I’ve also restarted Apache. Is there anything else I need to do?

  4. FractalizeR says:

    You need to restart Plesk.

  5. JDub says:

    Okay, I’ve done that as well. Must be missing something else? :)

  6. FractalizeR says:

    Yea. Reconfigure Plesk: /usr/local/psa/admin/bin/websrvmng -a
    Thanks, article updated.

  7. JDub says:

    I’ve done all of that and now Apache won’t even show it’s default page! I’ve got a 500 Server internal Error. :/

  8. FractalizeR says:

    That means Apache is incorrectly configured. Check it’s error log, it will tell you what’s wrong.

  9. JDub says:

    For some reason, I can’t access the log. :(

    Domain user login can’t get to it – Root login only shows Parallels, psa and plesk.key entries?!

  10. JDub says:

    I’ve had to pay someone else to fix it – Thanks for your help.

  11. FractalizeR says:

    I may help you free of charge, I think. But I will need root access to the server for this.

Leave a Reply

You must be logged in to post a comment. Login now.