Why does the address get redirected to port 8080 instead of port 80? - apache

I am trying to configure the apache load balancer on the docker container with enabled exposing port 80:80. Even load balancer configuration has been updated in load balancer config file with proper ips. Since the whole setup is working in same subnet they all are connected to each other. I am using wordpress image for web server , MySQL image for db and centos image for load balancer,even the firewall rule to masquerade has been done and port to enabled...Pls help
My loadbalancer config file
docker ps command
Error ...Why is it going to port 8080 even though I have configured 80 in loadbalancer file

As I can see here, you are trying to access 172.17.0.4:8080 on the browser. And IP 172.17.0.4 corresponds to the container wpos2. Now since you had not exposed the port 8080 of this container so the request is not being served from the browser.
Instead, you should try accessing the load balancer container lb1 using the public IP of your host machine.
Try this: <HOST_IP>:80
This will hit your load balancer and from there the request will be redirected to one of the two servers: wpos or wpos2 and you should probably get your request served.

Related

How to change default 80 port to my tomcat 8080 for my domain name

I am using tomcat on Linux centOs server. I want my java application is working fine on mydomain.com:8080. I want that my when some one hit the domain mydomain.com it automatically move to my java application.
Changin server.xml didm't worked for me. as i am also having apache2 on the server
I guess you have an apache server in port 80. I you do not want to remove apache and change directly the tomcat port ( see comments), you will need to redirect all traffic from port 80 to port 8080.
This can be done using tomcat connectors. They are plugins to connect web servers with Tomcat. When a HTTP request arrives, the plugin checks is it has to be redirected, connects to tomcat and returns the response to server
In the case of apache is needed to install mod_jk. In the link you can see the configuration

Google Load Balancer not passing traffic to back end

I am trying to use a load balancer to direct traffic to a container backend. The service in the containers hosts web traffic on port 80. My health checks are all passing. If I ssh into the Kubernetes host for the containers, I can curl each container and get correct responses over port 80. When I try to access them through the load balancers external IP, however, I receive a 502 response. I have firewall rules allowing traffic from 130.211.0.0/22 on tcp:1-5000 and on the NodePort port. I've also tried adding firewall rules from 0.0.0.0/0 ports 80 and 443 to those nodes.
When in the Kubernetes host, capturing with tcpdump, I see the health check requests to my containers, but no traffic is coming through when I make an external request.
I have an identical configuration that points to a single Compute Engine VM that works perfectly. This leads me to believe that the issue might be in the container setup rather than the load balancer.
Does anyone have any advice on resolving this issue?
I was able to resolve the problem by changing the Named Port that the Load Balancer was connecting to. By default, the Load Balancer connected to Named Port "http", which pointed to port 80. It was my assumption (always a bad thing) that this matched since my application serves on port 80. Not so. Since I'd exposed the containers though NodePort, it was assigned another port. This is the port I had my Health Check pointing to. By going into "Compute Engine -> Instance groups" selecting the group, and then "Edit Group", I was able to change the Named Port "http" to match my NodePort number. Once I did that, traffic started flowing.

Run apache in both host machine and docker container on 80 port

I need to setup something like automated server setup using docker. Now server machine should support both docker or normal setups. So I need to setup apache web server on both docker container and host machine on 80 port. Like
Host Machine : application1.serverhost.com
Docker Machine : application2.serverdocker.com
But Docker will not utilize 80 port as it is already bind on host machine apache. While I am thinking of use reverse proxy on host machine with apache like
Proxy Setting -> 172.17.0.2:8080
while on browser connect to proxy application2.serverdocker.com on 80 port. IP -> 172.17.0.2 is docker container IP which I am thinking to get from docker inspect.
But if any other way to handle this in docker itself where I can ignore reverse proxy on host machine. And call both application1.serverhost.com and application2.serverdocker.com from browser without appending port.
EDIT : One big issue using reverse proxy is that whenever I need to add another docker on same server I need to add also proxy for that new IP too as that would also running docker apache on other port like 8081 than Host port:80 and first docker's port:8080. In other words lot of reverse proxy settings and ports in case of lot of docker instances.
If you are using a reverse proxy, (like an NGiNX), that means both your Apache servers must run on ports different from 80.
Only your NGiNX would run (on host directly for instance) on port 80, and would redirect to localhost_apache1:xxx and 172.17.0.2_apache2:yyy.
From the user perspective, both Apache would be seen "as if" they were running on port 80 themselves.

How to have node and django running under one SSL server?

is there a way to solve this:
there is a domain example.com, on port 80 it redirects to 443 so it's always SSL connection and it passes to uwsgi via nginx. Now sockets run via a node connection on example.com:3000.
Is there an easy way to have that example.com:3000 run as SSL? The reason why is that Chrome gives a warning that the site includes resources that are not SSL.
I created another server in nginx, with the same domain listener but for different ports and passed the info through to node, and made that port SSL.

Apache Tomcat IP mapping to domain name

I am having apache tomcat server on my windows machine. Also I can access this server from other machines on the network.
Now I want to map the IP+Port combination to a name ie currently I have to write http://10.xxx.xx.xx:8080/app_name but I want to access it as http://app_name
How can I go about it? Is there any solution which I can achieve by adding some mapping in apache server file? Also DNS server is not in my control, any way to get around this problem?
Thanks
Rohit
By not specifying a port number, you are defaulting to port 80. Your options are to either modify your server to listen on port 80 or define an external load balancer VIP that does a PAT from port 80 to 8080.
If you take the VIP route, the hostname is defined on the load balancer. If you don't have that option and DNS isn't an option either, you could manually modify your hosts file with an alias. However, this would require all remote users to have your hostname - IP mapping in their local hosts files (making DNS the more manageable solution).
When user types the URL in browser, browser will establish TCP connection with web server in the port 80 by default in case of HTTP, 443 by default in case of HTTPS.
Yes. If Web server exposes any port other than default port, port has to be mentioned in the browser URL to connect and get the data.