• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

creating server-wide subdomain or subdirectory for plesk access

P

perler

Guest
hi,

i'd like to offer my clients an easier way to access the plesk control panel then the https://*:8443 URL. i thought about:

1) an automatically created subdomain cp.domain.com for each users domain which holds a file with a redirect statement to https://*:8443

2) an automatically created subdirectory domain.com/cp for each users domain which holds a file with a redirect statement to https://*:8443

or is this already implemented and i missed it completely?

PAT
 
Plesk does not have any of those 'automatic' things built in, however it can be done with the skeleton files and the Event Manager.

For #1, Basically you would create a vhost.conf and/or vhost_ssl.conf with the appropriate rewrite statements (using the event manager tags in place of an actual domain name), put the file(s) into the skeleton.

For #2, Then you can write a short script to use the command line utilities to create the subdomain and write the redirect index file. This script can be put into the Event Manager to be triggered on an event such as Physical Hosting Created (ie. once the domain's directory structure is created)

A simple sample of rewrite using @domain_name@ in vhost.conf for SKELETON FILE(from memory):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower

ServerAlias cp.@domain_name@
RewriteCond %{HTTP_HOST} ^cp.@domain_name@$
RewriteCond %{REQUEST_URI} !error_docs
RewriteRule ^/(.*) https://www.@domain_name@:8443 [L,R]

</IfModule>
 
as a first test, i put your rewrite code into ..vhosts/domain.com/conf/vhost.conf for a specific existing domain and restarted apache

unfortunately, the default rewrite for each subdomain (ie whatever.domain.com) points to the sitebuilder control panel so you statements doesn't seem to get into effect..

edited: meanwhile i removed the sitebuilder which i don't use anyay and now the default index.html comes up instead of the plesk cp.

edited again: i had to change

RewriteCond %{HTTP_HOST} ^cp.@domain_name@$

to

RewriteCond %{HTTP_HOST} ^cp.@domain_name@

coul'd you explain why you used $ in the first place and what consequences it has to remove it?

PAT


PAT
 
Sorry, I didn't make it clear. The example for vhost.conf is for the SKELETON file usage. If you are going to manually put it into an existing domain's vhost.conf file you would replace the @domain_name@ with the actual domain name.

Then you would do the following:

/usr/local/psa/admin/bin/websrvmng -u --vhost-name=yourdomain.tld

service httpd restart

When used in the skeleton, you don't have to do these 2 extra commands since Plesk does them when creating the new domain. I thought your question was about using skeleton files, so I didn't adjust my post to reflect if you wanted to manually enter the changes :) There are many of my posts regarding different vhost.conf rewrites in recent time.
 
so the $ behind @domain_name@ must be in the skel /vhost.conf, right? (it worked without..)

PAT
 
For this example, the $ can probably be left out. That just tells the rewritecond where to stop the matching process.
 
Back
Top