In Plesk, how to pass requests to the application listening on a local TCP port, so this port would not be displayed?

Follow

Comments

11 comments

  • Avatar
    Gkhan Yuksel

    Hi,

    I want to listen 80 and 443 port . Then redirect them to 8069 port. How I can do that using "Additional nginx directives" (If I add custom conf file, plesk overrides my conf file, so I have to do it over plesk panel)

  • Avatar
    Ivan Postnikov

    Hello @Gkhan,

    To achieve your goal, replace port 3000 to 8069 in the described solution in the article.
    Make sure that there is some application listening on correct IP and on port 8069.
    For example, running the command below in SSH:
    ---------
    ss -tlpn | grep :8069
    ---------
    It should display an application and its information.

  • Avatar
    Gkhan Yuksel

    Thanks for your respond. I have done your suggestion image below. It does not work for me.

    (if I delete  zz010_psa_nginx.conf file from "/etc/nginx/conf.d" directoriy. My custom file works. )

     

    Whe I run this code "ss -lnp | grep 8069". it shows "tcp    LISTEN     0      128       *:8069                  *:*  "

    I do not know what is meaning.

  • Avatar
    Gkhan Yuksel

    Hi, i found solution. When I uncheck "serve static files directly by nginx" it start working. (after reboot server)

  • Avatar
    Artyom Volov

    Hello @Gkhan Yuksel,

    Thank you for the update.

    Glad to hear that the issue was resolved!

  • Avatar
    Christian C.

    I am basically trying to do the same thing that this article describes but it does not work for me.

    I have a web app listening on port 8069

    I have:

    mydomain.com

    and

    subdomain.mydomain.com

    They are both secured with let´s encrypt.

    on mydomain.com y have an e commerce website and i would like to run the app listening on port 8069 running with https on the subdomain.

    I added the directives described on this post in the Additional nginx directives for the sub domain, I changed the port number but i only get a bad gateway 502 from nginx when i try to load the app.

    If i load the app with the subdomain in normal http it runs fine. https does not work.

    I even tried to upload a custom *.conf file to:

    /etc/nginx/conf.d

    with other directives, but it seems that plesk overrides them.

    I also tried to load a docker with nginx but i don´t know hot to configure it. I am not an expert in plesk or ubuntu.

    any ideas on how to solve this?

  • Avatar
    Alexandr Nikolaenko

    Hello,

    I have just re-checked the provided solution and HTTPS requests are proxied just fine.
    Please check that SSL support is enabled in Plesk > Domains > your_domain.tld > Hosting settings > SSL/TLS support and SSL certificate is installed.

  • Avatar
    Christian C. (Edited )

    Hello Alexandr,

    Thank you for replying.

     

    SSL is enabled for main domain and sub domain:

    I have no idea how to make this work.

    regards,

  • Avatar
    Nikita Nikushkin

    Hi @Christian C.,

    Make sure that without additional directives from the article, your subdomain works fine via HTTPS

    If it still does not work, review custom nginx configuration files if such exists and try to repair subdomain's configuration files:

    # plesk repair web one.example.com

    If the subdomain works as expected but breaks after adding the directives from the article, make sure that the port 8069 is listening:

    ss -tlpn | grep :8069

    The expected result is the following one:

    tcp LISTEN 0 128 *:8069 *:* "

    If it is listening but the issue still persists, reproduce the issue and check the following domain's, Apache and nginx log files:

    /var/www/vhosts/system/one.example.com/logs/proxy_error_log
    /var/www/vhosts/system/one.example.com/logs/error_log
    /var/log/nginx/error.log
    /var/log/httpd/ssl_error_log
    /var/log/httpd/error_log
    /var/log/apache2/error.log

    in order to figure out the cause of 502 error

  • Avatar
    Christian C.

    Hello Nikkita,

    Thank you for your response.

    I will answer your comments one by one:

     

    1. Make sure that without additional directives from the article, your subdomain works fine via HTTPS

    - If I remove the nginx directives the subdomain works fine with https

     

    2. If it still does not work, review custom nginx configuration files if such exists and try to repair subdomain's configuration files:

    # plesk repair web one.example.com

    - I removed the original custom *.conf file I uploaded to the server several days ago. I ran this command from putty just in case. It found no error, therefore, it did not repair anything.

     

    3. If the subdomain works as expected but breaks after adding the directives from the article, make sure that the port 8069 is listening:

    ss -tlpn | grep :8069

     

    - The app is listening on port 8069. The output was the following:

    LISTEN 0     128       0.0.0.0:8069       0.0.0.0:

    * users:(("python3",pid=848,fd=4))

     

    If it is listening but the issue still persists, reproduce the issue and check the following domain's, Apache and nginx log files:

    /var/www/vhosts/system/one.example.com/logs/proxy_error_log
    /var/www/vhosts/system/one.example.com/logs/error_log
    /var/log/nginx/error.log
    /var/log/httpd/ssl_error_log
    /var/log/httpd/error_log
    /var/log/apache2/error.log

    - I downloaded the files you suggested except for the files inside the httpd directory. This directory does not exist. The information inside these log files does not make much sense to me since I´m not an expert. If you want to download and view the log files you can do so from this link. it will expire in 6 days:

     

    thanks for your help.

    regards,

     

  • Avatar
    Nikita Nikushkin

    Hi @Christian C.,

    I suppose it is time for deeper issue investigation - please create a request to Plesk Support Department

    Also, please note that I edited your reply and removed the link to logs due to security reasons. Also, please do not share server logs in public channels in the future - it is not safe. Thank you for understanding!

Please sign in to leave a comment.

Have more questions? Submit a request