How to make Plesk accessible on a hostname without entering the port?

Follow

Comments

50 comments

  • Avatar
    valery frisch

    hi,

    I try add the additional nginx directive but it's not working, this is the error message : 

    Configuration Nginx non valide : nginx: [emerg] duplicate location "/" in /data/www/system/console.valactive.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

     

    What can i do to resolve this error?

    thanx

  • Avatar
    Lev Iurev

    @Valery check additional directives for the domain console.valactive.com, according to the error the issue is there

  • Avatar
    Grímur Daníelsson (Edited )

    I'm using Plesk Onyx v17.5.3_build1705170317.16 os_CentOS 7 and the steps are a little different, the firewall is a Plesk component not an extension, so make sure the component is enabled.

    But my main problem is that I'm unable to login after following these steps. The login page is displayed correctly but when I login i get redirected to the login page like I haven't logged in at all.

    EDIT: It was a browser problem for me. Works when I try it in incognito

  • Avatar
    Marat

    just in case someone is having same error like me or valery frisch:
    "Configuration Nginx non valide : nginx: [emerg] duplicate location "/" in /data/www/system/this.domain.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed"

    while "this.domain.com" is the domain where you want to enable proxy for plesk panel, you have to disable prosy and apply settings before adding "additional nginx directives" and then save configuration with additional directives again.

  • Avatar
    Webmaster

    Worked fine, but when I click "Updates & Upgrades" it redirects me to https://127.0.0.1:8447/?secret=&locale=en-US. How to fix this?

  • Avatar
    Lev Iurev

    @Webmaster unfortunatelly it does not work for "Updates & Upgrades" as it is listening on another port. 

  • Avatar
    Webmaster

    Thanks, Lev! When I type in my new Plesk hostname before the port 'plesk.mydomain.com:8447...' it works just fine. Would that be possible to make the Upades&Upgrades redirect relative to the hostname then, not the localhost? Hiding a port number for the updates will, of course, not be possible but still better than typing in a custom hostname every time.

    On the other note, I have noticed that proxying port 80 to 8880 or 8443 opens the port for everyone on the Internet. I suggest blocking that with nginx: 

    location / {

        if ($remote_addr = 0.0.0.0) {
            proxy_pass https://127.0.0.1:8443;
        }
        if ($remote_addr != 0.0.0.0) {
            return 404;
        }

    }
  • Avatar
    Thomas

    @Lev lurev Do you have a more detailed explanation as to why this happens? I used this method and it works fine for the Plesk login. However, I do have the same redirect problem as @Webmaster when trying to reach the "Updates & Upgrades" page.

    After the redirect fails I can change 127.0.0.1 back to sub.domain.ext and reach the page, so it does still work.

    Is there any way to fix the redirect so it doesn't change the host name initially and redirects to https://sub.domain.ext:8447?

  • Avatar
    Robert Asilbekov (Edited )

    @Webmaster I suppose that it will be better to restrict access via allow/deny

     

    location / {

    allow 192.168.1.0/24;
    # drop rest of the world
    deny all;

    proxy_pass ...

    }
  • Avatar
    Webmaster

    @Robert, even better since nginx conditional statements are in a rudimental state so far! Thanks!

  • Avatar
    Derek

    Unable to find the last step:
    What do I do?

  • Avatar
    Lev Iurev

    @Derek  Additional nginx directives option available only for Plesk Admin.

  • Avatar
    Jason Schilling

    After I followed all the steps I get back redirected to the login page after trying to login. Using the incognito mode doesnt work.

  • Avatar
    Lev Iurev

    @Jason may I know your Plesk version and directives you added.

  • Avatar
    Jason Schilling (Edited )

    I'm using Plesk Onyx v17.5.3_build1705170317.16 and added only the one directive that was given for Onyx in this article. I changed only the domain to the IP-Address.

    location / {
    proxy_pass https://IPv4-Address:8443; 
    port_in_redirect off;
    }

  • Avatar
    Lev Iurev

    @Jason, I see the point, reproduced the same on the test server. Thank you for your notification, the article requires internal review. We will re-check the article and update it with required information.

  • Avatar
    Jason Schilling

    @Lev thank you for the fast reply. I will wait for the fix.

  • Avatar
    Simeon Ivaylov Petrov (Edited )

    Hello I have the psa-17.5.3-cos7.build1705170317.16.x86_64 version installed and I followed the article, but when I try to login into "http://plesk.mydomain.tld" I always get a redirect to the same page (url: "https://plesk.mydomain.tld/login_up.php?success_redirect_url=https%3A%2F%2Fplesk.mydomain.tld%3A8443%2F").
    When I add the port there is no problem (http://plesk.mydomain.tld:8443), but without the port I get always redirected. Can I use it without the port or it is required for working?

  • Avatar
    Bulat Tsydenov

    8443 is the port on which sw-cp-server (Plesk web server) is listening. It is required for working.

  • Avatar
    Simeon Ivaylov Petrov (Edited )

    So there is no solution to have a clean url for my clients without obligating them to put the port every time?

    Edit: In fact, the topic of this thread says "...without entering the port?"

  • Avatar
    Konstantin Annikov

    You can configure Plesk to be opened on the address like the following (clean url):

    https://example.com

    Please read the instructions in this article to do it.

    You can also add a sub-domain like "plesk.example.com" using the same instructions.

  • Avatar
    Simeon Ivaylov Petrov (Edited )

    @Konstantin, as I said 3 comments above, I've already done it, but it continuously redirects me to the login page. I've followed all the steps in this article (version: psa-17.5.3-cos7.build1705170317.16.x86_64).

  • Avatar
    Konstantin Annikov (Edited )

    Oh, yes, I see. 

    The last part of the link could not be hidden. 

    However it occurs on the login page only and it (last part) is grayed out in the status bar in most of modern browsers (For example Chrome and Safari). 
    So, i believe that it is not a big problem. 

    However if you think that such functionality should be implemented in Plesk as a native one (function to add a domain to access Plesk without entering port number), you can create corresponding feature request here: 

     https://plesk.uservoice.com/forums/184549-feature-suggestions

    The top-ranked suggestions are likely to be included in the next versions of Plesk.

  • Avatar
    Simeon Ivaylov Petrov

    @Konstantin, I did not understand what do you mean by:

    The last part of the link could not be hidden. 

    However it occurs on the login page only and it (last part) is grayed out in the status bar in most of modern browsers (For example Chrome and Safari). 
    So, i believe that it is not a big problem. 

    Can you clarify what do mean please (especially "The last part of the link could not be hidden")?

    Thank you

  • Avatar
    Artyom Baranov

    @Simeon Ivaylov Petrov,

    Hi! Konstantin mentioned about the following part of the request in a browser: login_up.php?success_redirect_url=https%3A%2F%2Fplesk.mydomain.tld%3A8443%2F

    This means that when accessing Plesk using a hostname without the port, browser redirects to Plesk login page and shows that redirection is successful.

    This behavior is expected.

     

  • Avatar
    Simeon Ivaylov Petrov

    @Artyom

    Hi Artyom! So currently there is no solution to use the login page (and so login to the admin panel) without entering the port and I will always be redirected if I do not enter the port in the login URL? Why this article suggests this solution if you are unable to access the admin panel through the login page without the port in the first place?

    Thanks

  • Avatar
    Konstantin Annikov

    @Simeon

     

    Could you please watch this video

    Here you can see the solution on how to "use the login page (and so login to the admin panel) without entering the port"

    I just performed the steps from the article and as a result I can use the plain URL as a login page to Plesk. 

    Does it meet your expectations? 

  • Avatar
    Simeon Ivaylov Petrov (Edited )

    @Konstantin

    No. Thank you for your video but my problem begins when your video ends. As I said many times, I made the steps of the artical. Maybe my English is not clear enough and I am sorry if so. The problem is not accessing the login page without the port. The problem is loging in the admin panel after that. As I said, when I try to log in (when I enter username and psw and click the Log In button) I am allways redirected to the same login page and so I can not access the admin panel because of that. Accessing the login page without being able to log in into the admin panel after that is usless for me.

  • Avatar
    Konstantin Annikov (Edited )

    @Simeon, 

    Finally I reproduced your issue. 

    The main point here is: 

    1. Host under "Plesk > Domains > example.com > Apache & nginx settings" should be the same as subcription's name.
      If subscription's name is "plesk.example.com" and the following directive is  defined in Apache&nginx directives: 

      location / {
      proxy_pass https://example.com:8443; 
      port_in_redirect off;
      }

      Then you will be redirected back yo login screen right after login. 
    2. The host should be resolvable from the sever. It is needed to perform a DNS lookup from nginx. (If you are using private domain name, please define it in /etc/hosts file)

     

    So, please make sure that host is resolvable and proxy_pass has the same domain name as domain's name and get back to us in case the issue still here. 

    I will update the article accordingly. 

  • Avatar
    Simeon Ivaylov Petrov

    @Konstantin

    Unfortunately this is not the problem. My Host under "Plesk > Domains > example.com > Apache & nginx settings" is correct and the same as the subscription name. I get redirected anyway. Here are my configurations corresponding to each steps:

    1) & 2) steps seen here: The domain name created is "admin.mydomain.com"

    3) & 4) & 5) steps seen here (done separately 1 by 1): The host under additional nginx directives is https://admin.mydomain.com:8443

    Even in this situation, I am always redirected back to the login page when I try do log in to the admin panel.

Please sign in to leave a comment.

Have more questions? Submit a request