SSL/HTTPS Not Being Served (via nginx_apache)

youds

Verified User
Joined
Jul 11, 2008
Messages
490
Location
Lancashire, UK
Hi

I recently setup a proxy using information from here (as below) however it isn't forwarding https requests.

Code:
|?PROXY_IP=domain.tld|
|?PORT_8080=XXXX|

Any ideas on how to have the https traffic re-routed, along with the http traffic?

For a bit of background, basically the system is running on a separate port which also reports https is not working, so it could be a wider problem with the http and https requests not being sent to the platform/system.

Kind regards
 
PORT_8080 is HTTP
PORT_8081 is HTTPS

try add "PORT_8081" too,
I don't know variable to seperate between HTTP and HTTPS site, so.. try simple
 
Hi,

Struggling with this. While it redirects, it goes to a 502 Bad Gateway. Is there any headers or something that I should be including for it to work with https?

Thanks in advance!
 
Still need a remedy for this if anyone can help, the 8081 port setting did indeed redirect me, but only to a bad gateway page. Really strange because this has never happened before, with this software. http working, https is not.

I went to the people who provide the software to get their take on it and did not get much help as they do not differentiate between http and https. Which is kinda frustrating.

Any tips greatly welcomed.

*^&^%
 
Did a clean install of the software and it has given same results. Bypassing proxy to use specific IP addresses - doesn't work. Bypassing my custom httpd settings with a fresh install - doesn't work. Must be something more intrinsic?
 
&%$£%^

This is annoying me! I've had this software work under numerous installs (at a cost) and for some reason https doesn't seem to work.

Code:
|?PROXY_IP=sub.domain.tld|
|?PORT_8080=10020|
|?PORT_8081=10020|

I have the above in my custom httpd config. When accessing http, fine - it works, https - it says "502 Bad Gateway".

Any ideas?
 
maybe need add "proxy_redirect off" to "custom2"
it's in location section
 
Thanks for your reply.

It says "invalid number of entries" - I added (literally) "proxy_redirect off" to CUSTOM2.
 
I tried |?proxy_redirect=off| and it worked - has not fixed the issue. To be fair though, I only restarted httpd service at cli level, is there something else I need to do?

Kind regards
 
I tried |?proxy_redirect=off| and it worked - has not fixed the issue. To be fair though, I only restarted httpd service at cli level, is there something else I need to do?

Kind regards
that only change value for custombuild variable

but issued I think it too many redirect

"proxy_redirect off;"
I think, you forgot " ; " ?


I can't help anymore, maybe you should direct change in "/usr/local/directadmin/data/user*/...../nginx.conf"

and just restart nginx
 
I tried |?proxy_redirect=off| and it worked - has not fixed the issue. To be fair though, I only restarted httpd service at cli level, is there something else I need to do?

Kind regards
Hi, I know it's been a little while, a 1-year-old thread but I'm having the same issue and wondering if you found the solution?

I am very new to all of these... Usually, we develop using WordPress or PHP but now we started using nodeJS which requires deploying apps and running a node server on a port. So instead of only nginx we switched to apache_nginx because there are many accounts that still need .htaccess files. Apparently only using apache for Node isn't recommended. It was quite hard to get it to work because almost all tutorials out there are made for centos, apache, or Nginx on a non-shared server without an admin panel.

So, finally figured out that we need to use those "tokens" to make changes to nginx_apache configuration files. Our app is running on port 3000 and forwarding 8080 to 3000 works. But not secure. Forwarding 8081 to 3000 we get a bad gateway even though the app server is running (however, the site looks secure, as SSL is active).

With custom code, nginx.conf file for thaicitizen.org file looks like this:

Code:
# Auto generated nginx config file by DirectAdmin version 1.641
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to their website
# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=558
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3
server
{
    listen 103.13.231.113:80;
    server_name thaicitizen.org www.thaicitizen.org ;
    access_log /var/log/nginx/domains/thaicitizen.org.log;
    access_log /var/log/nginx/domains/thaicitizen.org.bytes bytes;
    error_log /var/log/nginx/domains/thaicitizen.org.error.log;
    root /home/thaicitize/domains/thaicitizen.org/public_html;
    index index.php index.html index.htm;
    include /usr/local/directadmin/data/users/thaicitize/nginx_php.conf;
    location /
    {
        # access_log off;
        proxy_buffering off;
        proxy_pass http://thaicitizen.org:3000;
        proxy_set_header X-Client-IP      $remote_addr;
        proxy_set_header X-Accel-Internal /nginx_static_files;
        proxy_set_header Host             $host;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_hide_header Upgrade;
    }
    location /nginx_static_files/
    {
        # access_log  /var/log/nginx/access_log_proxy;
        alias       /home/thaicitize/domains/thaicitizen.org/public_html/;
        internal;
    }
    include /etc/nginx/webapps.conf;
}
server
{
    listen 103.13.231.113:443 ssl http2;
    server_name thaicitizen.org www.thaicitizen.org ;
    access_log /var/log/nginx/domains/thaicitizen.org.log;
    access_log /var/log/nginx/domains/thaicitizen.org.bytes bytes;
    error_log /var/log/nginx/domains/thaicitizen.org.error.log;
    root /home/thaicitize/domains/thaicitizen.org/private_html;
    index index.php index.html index.htm;
    ssl_certificate /usr/local/directadmin/data/users/thaicitize/domains/thaicitizen.org.cert.combined;
    ssl_certificate_key /usr/local/directadmin/data/users/thaicitize/domains/thaicitizen.org.key;
    include /usr/local/directadmin/data/users/thaicitize/nginx_php.conf;
    location /
    {
        # access_log off;
        proxy_buffering off;
        proxy_pass https://thaicitizen.org:3000;
        proxy_set_header X-Client-IP      $remote_addr;
        proxy_set_header X-Accel-Internal /nginx_static_files;
        proxy_set_header Host             $host;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_hide_header Upgrade;
    }
    location /nginx_static_files/
    {
        # access_log  /var/log/nginx/access_log_proxy;
        alias       /home/thaicitize/domains/thaicitizen.org/private_html/;
        internal;
    }
    include /etc/nginx/webapps.ssl.conf;
}

There are also these templates there you can see, but I'm not sure if I should be editing those and how?

I deployed some sample code to a domain we don't use to take some screenshots, have a look, please. What am I doing wrong here? Thanks in advance...
 

Attachments

  • whats-this.png
    whats-this.png
    205.7 KB · Views: 0
  • Screen Shot 2022-06-07 at 15.53.12.png
    Screen Shot 2022-06-07 at 15.53.12.png
    85.7 KB · Views: 0
  • Screen Shot 2022-06-07 at 16.01.13.png
    Screen Shot 2022-06-07 at 16.01.13.png
    15.2 KB · Views: 0
  • Screen Shot 2022-06-07 at 16.01.32.png
    Screen Shot 2022-06-07 at 16.01.32.png
    93 KB · Views: 0
  • Screen Shot 2022-06-07 at 16.02.13.png
    Screen Shot 2022-06-07 at 16.02.13.png
    26 KB · Views: 0
@lotuscuk
You should create your own Topics/Threads for your Question, But I will be answer here in now.


maybe trying edit "proxy_set_header Host" to something like this.
Code:
proxy_pass https://thaicitizen.org:3000;
proxy_set_header Host thaicitizen.org;
 
@lotuscuk
You should create your own Topics/Threads for your Question, But I will be answer here in now.


maybe trying edit "proxy_set_header Host" to something like this.
Code:
proxy_pass https://thaicitizen.org:3000;
proxy_set_header Host thaicitizen.org;
Thanks for the reply...

Add it how though?

Like this?:
Code:
|?PROXY_IP=thaicitizen.org|
|?PORT_8080=3000|
|?PORT_8081=3000|
|?proxy_set_header host=https://thaicitizen.org;|

This didn't change anything on the nginx.conf. ,still looks the same.
 
try change directly in nginx.conf after you get workaround, next step just think solulion how to put it.

in my answer, there no way to change from template ( or possible ways, idk ) .

Please create your own threads. People can saw your title and answer there.
 
Back
Top