wordpress nginx docker reverse proxy does not work - wordpress

I have a nginx server dockerized running like below:
I have a wordpress dockerized running like below:
and nginx config for it:
When I enter http://my_domain.com:8080 it returns worpdress page correctly.
But when I enter http://my_domain.com/ it returns 502 Bad Gateway
Here is the log when I enter http://my_domain.com/ it returns 502 Bad Gateway
================================================================
But when I change the wordpress host:container port to 8080:9000 and fastcgi_pass to 9000 like many online tutorials show:
when I go to http://my_domain.com:8080 it cannot access wordpress page and shows:
The site can't be reached. my_domain.com refused to connect
With port 8080:9000, when I go to http://my_domain.com, It still shows 502 Bad Gateway with nginx logs:
*54 connect() failed(111: Connection refused) while connection to upstream 'fastcgi://ip:9000

Related

HTTP proxy_pass to HTTPS works on localhost but not on AWS EC2

I have an NGINX configuration that forwards HTTP to HTTPS. It works fine on my local system and it fails on an AWS EC2.
Here's the only configuration I have added to NGINX, the rest is left intact:
server {
listen 58080;
server_name localhost;
location / {
proxy_pass https://acme.com;
}
}
When serving the content (a single web page UI app) from my laptop everything works as expected. When trying to server the content from AWS I keep seeing errors in the dev-tools console as bellow:
GET https://ec2-*****.compute.amazonaws.com:58080/assets/index.5c112cd8.css net::ERR_SSL_PROTOCOL_ERROR
GET https://ec2-*****.compute.amazonaws.com:58080/assets/index.5660fafb.js net::ERR_SSL_PROTOCOL_ERROR
GET https://ec2-*****.compute.amazonaws.com:58080/favicon.ico net::ERR_SSL_PROTOCOL_ERROR
Something overwrites the protocol from HTTP to HTTPS. I did try just copy-n-paste these links and replace the protocol to HTTP and it works for this link specifically.
I did try adding additional directives such as proxy_set_header Host $proxy_host; and/or changing the server_name _; or the specific host of my EC2 instance but still got the same result.
Both systems env:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
$ nginx -v
nginx version: nginx/1.22.0
I will definitely add a self-signed certificate to NGINX next which I believe it will resolve my issues but I am curious why it works on my localhost while on AWS it does not.

MAMP http request to port 80 returns connection refused error on port 8888

I have set the Apache port to 80 on MAMP. The the request to "http://localhost/MAMP" (the startup page, port 80) works fine. However, when I try to access the "http://localhost/" it gives a connection refused error. on port 8888?
the MAMP page works fine
http://localhost/ redirects to localhost:8888 resulting in error
http request and corresponding error message
Things I have tried:
disable mac built-in Apache with apachectl stop - Does not work
check activity on port 80 (nothing suspicious) - Does not work
port 8888 works fine but my goal is to have an simple url format to able to use xdebug with it.

Kubernetes Dashboard : Dashboard keeps cancelling connection to pod, resulting in bad gateway to user

I am using kubernetes-dashboard to view all pods, check status, login, pass commands, etc. It works good, but there is a lot of connectivity issues related to it. I am currently running it on port-8443, and forwarding the connection from 443 to 8443 via Nginx's proxy pass. But I keep getting bad gateway, and connection keeps dropping. It's not an nginx issue, since I have kubernetes error. I am using Letsencrypt certificate in nginx, What am I doing wrong?
Error log :
E0831 05:31:45.839693 11324 portforward.go:385] error copying from local connection to remote stream: read tcp4 127.0.0.1:8443->127.0.0.1:33380: read: connection reset by peer
E0831 05:33:22.971448 11324 portforward.go:340] error creating error stream for port 8443 -> 8443: Timeout occured
Theses are the 2 errors I constantly get. I am running this command as a nohup process :
nohup kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443 --address 0.0.0.0 &
And finally my nginx config :
default :
location / {
proxy_intercept_errors off;
proxy_pass https://localhost:8443/;
}
Thank you. :-)
Unfortunately this is an on-going issue with Kubernetes' port forwarding. You may find it not particularly reliable when used for long-running connections. If possible, try to setup a direct connection instead. A more extended discussion regarding this can be found here and here.

Local wordpress installation issues on port 8080

I'm using XAMPP as my local apache server. For some reason I can't use Port 80 and hence I changed the Listen and Servername to localhost:8080.
Now when I'm trying to install a wordpress site I'm getting the below error if I put localhost:3306 or localhost
wp-installation-error
And If I try to specify localhost:8080 as DB host, it goes into a "waiting for localhost" and times out after few minutes.
setup
Can someone help me how to set it up?

https://localhost:8080 is not working but http://localhost:8080 is working well

I am using Ubuntu 12.04LTS 64 bit pc.JBOSS as my local pc server and i have a project which is using mysql as database and struts framework.I can easily access my project using
http://localhost:8080
but when I want to access my project using
https://localhost:8080
It shows an error.
The connection was interrupted
The connection to 127.0.0.1:8080 was interrupted while the page was loading.
I have also checked
$ sudo netstat -plntu | grep 8080
this command which output is
"tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 5444/java"
If i kill this process,my project also killed.
and i also mentioned u that my 80 port is free also.
Can you tell me what is the problem is occured for which I cannot access my project in my local pc using https.
Advance Thanks for helping.
SSL has to be on a different port. Here is the breakdown:
http:// watched on port, typically 80
https:// watched on a different port, typically 443
You need to RUN SSL on a different port.
Listen 8081
SSL VirtualHost
<VirtualHost *:8081>
# SSL Cert info here
....
</VirtualHost>
> service httpd restart

Resources