Plesk

How to configure redirect from Web Server’s Default Page or existing domains to the Plesk login page on port 8443 on Plesk for Linux?

Question

On a Plesk for Linux server, it is required to configure a redirect to the Plesk login page on port 8443 from the Web Server's Default Page or website that exists in Plesk.

How can it 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

Configure a redirect from the Web Server's Default Page

  1. Connect to the server via SSH

  2. Create the file /var/www/vhosts/default/htdocs/.htaccess:

    # touch /var/www/vhosts/default/htdocs/.htaccess

  3. Add the following content to it using text editor:

    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.

Configure a redirect from a domain that exists in Plesk

  1. Log in to Plesk GUI

  2. Go to Domains > example.org > Apache & nginx Settings

  3. Add the following additional directives:

    • If the field Additional nginx directives is present, add the following content to it's beginning:

      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:

      Redirect "/" "https://example.com:8443/"

    Note: example.com should be replaced with the hostname of the server.

Exit mobile version