• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

alias /plesk to the control panel

J

jspilon

Guest
Hi all,

I need help creating an alias for domains to have /plesk

www.domain.tld/plesk

to point to the control panel, i consider doing this on https and have a redirect on http for /plesk to switch onto https

i understand i need to modify an apache's ".conf" file to create the alias, but wonder if it needs to be a ScriptAlias...

Can any1 help me sort that out ?
 
You would not modify the httpd.conf or httpd.include, nor do any ScriptAlias.

Simply modify the domain's vhost.conf file:

Code:
# Add to vhost.conf to redirect [url]http://www.domain.com/plesk[/url] to normal CP URL
# You do not need to even create the folder or any file contents
#
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap	lowercase	int:tolower
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/plesk(.*) [url]https://domain.com:8443[/url] [R,L]
</IfModule>
# The RewriteRule could include the [url]www.[/url] or not
What this does is:

1. Turn the rewrite engine on
2. Tell the engine to lowercase everything
3. Match if it is a request on port 80
4. Check if the request is for /plesk and if so then Redirect it to the normal control panel URL.

If you like having the 'www.' in the URL, then change the RewriteRule to be:
RewriteRule ^/plesk(.*) https://www.domain.com:8443 [R,L]
 
thank you for your answer, the only problem is that i dont want the /plesk to redirect to the regular address used for the control panel, but actually to load the control panel...

some of my customers are running restrictive firewalls in their company and cant access the control panel easily...

thanks
 
Ah yes, that is so much clearer. AFAIR cPanel has their own proxy stuff already setup, so that makes it a bit easier than on Plesk servers which don't have any sort of proxy already setup.

As Cranky posted in the other thread,
Alternative solutions would probably include using iptables or setting up a proxy server, but until you have time to play with this I'd suggest doing the above.
Plesk itself does not have anything already built-in, many of us wish they did... The Iptables port redirection would need a separate IP (if I remember correctly) for the control panel.

Of course, you could try to do it with Apache's Proxy/ProxyPass type directives in the httpd.conf / httpd.include files which may get overwritten by Plesk. I've seen posts where people have tried that in vhost.conf / vhost_ssl.conf without much success.
 
Originally posted by jamesyeeoc
You would not modify the httpd.conf or httpd.include, nor do any ScriptAlias.
Simply modify the domain's vhost.conf file:
Code:
# Add to vhost.conf to redirect [url]http://www.domain.com/plesk[/url] to normal CP URL
# You do not need to even create the folder or any file contents
#
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap	lowercase	int:tolower
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/plesk(.*) [url]https://domain.com:8443[/url] [R,L]
</IfModule>
# The RewriteRule could include the [url]www.[/url] or not
Can this be done for the whole server (any domain on it)? I made my server-wide modifications for apache in server-tuning.conf, this file seems not to be overwritten as often as httpd.conf....
 
Unfortunately, the sample I posted will not avoid situations where the client is behind a firewall blocking port 8443. Once the initial redirect happens, the user's browser would then revert back to needing port 8443. Really the only thing this is good for is so the clients don't have to remember the more lengthy URL with the port number and all.

For that scenario, you would have to do a proxy of some sort (on the server or using an external proxy), or possibly port redirection on the server's firewall (would require dedicated IP for the control panel).

With Plesk there is unfortunately no 'quick and easy' or 'click here' solution. cPanel has certain things already in place to do it, so it is easier.

I just had a thought and will have to check it out. Using a service such as No-IP.com it may be possible to do it. I'll have to experiment when I get a chance. (Not sure if their 'free' service has the port redirect, or if it's just their paid service)
server-tuning.conf, this file seems not to be overwritten as often as httpd.conf....
I wasn't aware that conf file was installed by Plesk, I've never seen one of their installers or upgraders create that file nor put the Include line in the httpd.conf/include for it. I have always created my own and so I know it does not get overwritten.
 
Back
Top