Applicable to:
- Plesk for Linux
Question
On a Plesk for Linux server, a redirect to the Plesk login page on port 8443 must be configured from the web server's default page or an existing website in Plesk.
How can this be done?
Answer
Warning: Configuring the redirect will result in an inability to issue/renew Let's Encrypt certificate due to the Let's Encrypt requests are performed with ports 80/443
- Connect to the server via SSH
-
Create the file
/var/www/vhosts/default/htdocs/.htaccess:# touch /var/www/vhosts/default/htdocs/.htaccess
-
Add the following content to it using text editor:
CONFIG_TEXT: RewriteEngine On
RewriteCond %{HTTP_HOST} ^203.0.113.2$
RewriteCond %{HTTP_HOST} ^203.0.113.3$
RewriteRule ^.*$ https://example.com:8443/ [R,L]
Redirect 301 / https://example.com:8443/Note: 203.0.113.2, 203.0.113.3 and example.com should be replaced with public IP addresses and hostname of the server respectively.
- Log in to Plesk GUI
- Go to Domains > example.org > Apache & nginx Settings
-
Add the following additional directives:
-
If the field Additional nginx directives is present, add the following content to it's beginning:
CONFIG_TEXT: return 301 https://example.com:8443/;
-
If the field Additional nginx directives is absent, add the following content to both fields Additional directives for HTTP and Additional directives for HTTPS:
CONFIG_TEXT: Redirect "/" "https://example.com:8443/"
Note: example.com should be replaced with the hostname of the server.
-
Comments
Please sign in to leave a comment.