How to proxy requests from domains to Docker container in Plesk?

Follow

Comments

13 comments

  • Avatar
    Unknown User

    Im currently using the Litespeed Webserver addon which requires Nginx to be turned off to work. How can i run nginx only for docker proxy without interfering with my litespeed webserver? Or is this impossible?

    0
    Comment actions Permalink
  • Avatar
    Alexandr Redikultsev

    Hi @Blake Moore.

    Nginx can be enabled only server-wide, so in case of Litespeed it is hardly an option. In theory, it should be possible to configure some sort of proxy in Litespeed configuration files manually, however this scenario was not tested and it will be impossible to manage this via Plesk as described in the article.

    0
    Comment actions Permalink
  • Avatar
    Andy Perry

    Hi, is it possibe to add a rule that routes mydomain.com/ ports 80 & 443 to the same docker image ?

     

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Andy,

    If I understood you correctly, you mean that your image also uses ports 80 and 443 inside.

    This article describes your case.

    Following the guide, you need to map image port with external, for example, 32768.

    After that, the step 4 allows to redirect your domain via ports 80 and 443 to external image ports.

    0
    Comment actions Permalink
  • Avatar
    Andy Perry

    Hi Ivan no, my image uses different ports which are mapped to ports 80 & 443 as per the first image in the article. I have done this the problem is when setting up the proxy rule i can select to forward either port 80 or port 443 to my container not both.

    0
    Comment actions Permalink
  • Avatar
    Alexandr Zubtsovsky

    Hello Andy,

    Plesk interface allows mapping only one port to Docker container at a time. This is behavior by design.

    Vote for this feature, and leave your feedback as a comment here (top voted ideas are likely to be implemented in next product releases):

    https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/36927160-plesk-ui-domain-domainname-docker-proxy-rul 

    0
    Comment actions Permalink
  • Avatar
    Gonzalo Besoain (Edited )

    I have an odoo instance running with docker and that instance is proxied to a domain that has SSL certificate installed.

    If I visit https://oddosamplesite.com it will navigate under SSL but if I logout goes back to the non secure version.

    How can I force the use of HTTPS on this instance?

    0
    Comment actions Permalink
  • Avatar
    Maxim Krasikov

    Hello @Gonzalo Besoain

    Please make sure that option "Permanent SEO-safe 301 redirect from HTTP to HTTPS" is enabled for the domain in Plesk > Domains > oddosamplesite.com > Hosting Settings.

    If the issue still persist please submit a ticket to technical support under the link: https://support.plesk.com/hc/en-us/requests/new

    1
    Comment actions Permalink
  • Avatar
    Nerque

    I would like, if I have configured the port map in docker as 3330->3333, to be able to set a redirection in nginx as 6666->3330.

    Is this possible? (https:6666 -> 3330 -> 3333)

    Manually I can do it by modifying the nginx conf of the domain (listen x.x.x.x:443 ssl http2 ==> listen x.x.x.x:6666 ssl http2).

    This way I can automatically assign the certificate of an SSL connection using 6666.

    But of course, when the file is regenerated, the change is lost...

    0
    Comment actions Permalink
  • Avatar
    Julian Bonpland Mignaquy

    Hi Nerque, if you don't want to loose the changes when the file regenerated you can use configuration templates as described here https://support.plesk.com/hc/en-us/articles/115000276014-How-to-create-custom-Apache-and-nginx-configuration-files-for-all-domains.

    In that way then the file regenerated you will not loose the changes.

    0
    Comment actions Permalink
  • Avatar
    Roman Bendik

    Does it work for someone?, I am looking for help everywhere and there is silence, nobody knows anything?

    https://talk.plesk.com/threads/docker-with-nginx-proxy-502-bad-gateway.355741/#post-874816

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Roman Bendik

    As I can see, you've solved the issue on your side.

    It would be great if you could share steps you've used to resolve the issue.

    0
    Comment actions Permalink
  • Avatar
    Richard Small (Edited )

    So for all the Litespeed users out there scratching their heads on how to achieve this, I've put together a very straight forward guide that uses the WebAdmin Console + Apache directives:

    https://smallbyte.tech/2020/06/27/how-to-plesk-litespeed-docker-reverse-proxy/

    It's much easier than you'd think, it's a shame that Plesk doesn't support this, it's 100% possible, it would simply need to detect if LSWS was being used and if so amend its process for making configuration changes to add extProcessor in the httpd_config.xml and add directives to Apache Vhost Config.

    Hope this helps some of you.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request