Possibly Port Error - apache

I already installed Tomcat server while developing my java web app. But I also needed to get access to my database using PHPMyAdmin and install MySQL as well, so I downloaded XAMPP. I cannot disable apache server since I already have Tomcat. Now my struggle is, I cannot open
"localhost:8080" which was my original port. It's now replaced with simply "localhost".
Can you help me fix this error? THANK YOU :D

Sounds like you now have:
Tomcat serving traffic on port 8080, as it always has (at http://localhost:8080)
Apache/XAMPP serving traffic on port 80 (at http://localhost, obviously with the port missing since 80 is the default http port)
Assuming that's the case, you don't have a problem. Serving http traffic from different ports on the same host is not an issue.

Related

apache2 not working with port other than 80

I have nginx running at port 80.
After installing apache2, I set its port to 82 (both in ports.conf and 000-default.conf).
I have tried opening the ip (i.e a.b.c.d:82) but its not opening. But if I set port to 80 and stop nginx then its opening.
I tried opening ip with the below format:
a.b.c.d:82
a.b.c.d - opening nginx site
I also tried setting dns to abc.mydomain.com and opened
abc.mydomain.com (opening nginx site)
abc.mydomain.com:82 (not opening anything)
How to access it using apache with some port other than 80 ?
Please let me know for more questions.
Thanks.
The discussion and investigation in the chat revealed that this actually was about a remote system, not a local development setup. That means that typically a package filter ("firewall") is in between client and sever. When using a non standard port for a "well known protocol" you need to open that port in the servers firewall for incoming traffic.
In this case using Ubuntu's ufw tool had been used to setup a simple package filter. Configuring the custom port 82 and allowing incoming traffic to it solved the issue at hand.

Using Apache server beside Windows' World Wide Web Publishing Service

I have an old site (oldsite.com) running via World Wide Web Publishing Service on a Windows Server 2003 server. I've just create a new site (newsite.com) using the same server but running through Apache. The old site with its service running on port 80 already so I had to config Apache using port 8080. The problem is now when I publish my new site, the url has to be newsite.com:8080. How can I config Apache so that it can contain no port, just newsite.com?
As far as I know from personal experience and research:
Due to the nature of DNS Records you cannot specify the domain to redirect to an IP address and a port.
If both servers are listening on the same port a request would not know which site to direct to.
As the default port the domain specifies is port 80, any other port must be specified for the request to go to the correct location.
Therefor you cannot have newsite.com redirect to the server IP on port 8080, as it can only be directed to the server IP with DNS records. The port must be specified in the URL if it is on a port other than 80.
Edit: I just found this post about using a reverse proxy to do something similar to what you have described. Take a look and see if it helps you.
You cannot have two services listening on the same port. You can change the old site to listen to another port, set apache to port 80, then use mod_proxy to enable the old site to be accessed from apache using virtualhost
I have just make it work. Although in IIS Manager, there was no website listening on 0.0.0.0:80 but I still had to delete this entry by httpcfg tool. After that Apache can start normally.

Intermittent outside connectivity but connections work locally?

I'm running apache on an AWS server and I have an issue that I can't find any answers to. Normally I'd trawl through this site until something similar crops up and work with that but I can find literally nothing on this:
Apache 2.4 running on AWS Windows 2012
Listening on port 443 correctly
Everything works fine
Something goes wrong.
Apache cannot be accessed outside of the server
Apache is available locally on port 443
Apache is still listening on port 443
No new TCP connections are being established to the server from the outside world.
With the above information, anyone would think that the issue is with the AWS server but it isn't..
Bouncing the Apache 2.4 service on the AWS server corrects the issue and allows connections in from the outside world.
I'd really appreciate some help with this one.. it's been driving me crazy!
Thanks
Will

Apache Server - Change port from 8080 to 80

I have recently bought Amazon EC2 server.
Instead of installing it trough command line, I downloaded the latest zip file and deployed my application in WebApps folder.
The problem is tomcat is listening all the requests on port 8080 instead of 80.
I have tried changing the server.xml file in conf folder but no help!!
It is still listening to port 8080.
How do I make it listen to port 80
Oddly enough, Tomcat has its own documentation about doing this:
http://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F
Probably the most straightforward way on *NIX is to use jsvc which is a small utility that works by binding to a port, dropping privileges, and then launching Tomcat, which can then use lower-numbered ports.
There are a bunch of other ways, but jsvc is the easiest and offers some other benefits as well. Discovering those benefits is left as an exercise for the reader.
The following would apply toward various systems, while the second link would related toward windows based systems.
First link :http://www.klawitter.de/tomcat80.html
Second link:
http://javarevisited.blogspot.com/2011/12/how-to-change-tomcat-default-port-8080.html?m=1
Ok. So finally I figured out way to solve this problem.
First of all i was doing it wrong way. One should not open port 80 for tomcat7. Tomcat7 should always run port 8080 or anything which is greater than 1024.
So to make your web site work without port. Follow below steps.
Install Apache2. (By default it runs on port 80).
Go to localhost and make sure apache2 is installed properly.
Then you will have to redirect all the requests which are going on port to redirect to port 8080.
To do that follow below link. (this is important step)
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
Hope this answer helps!!!
Thanks
Fahad Mullaji
I wouldn't recommend doing that, for what it is worth...
That could work in theory, but you are literally using httpd as a proxy to forward every request. There isn't much of a reason, IMHO, to choose this over simply changing the port to 80 in the Tomcat configuration and ditching httpd. You can use port 80 for Tomcat but historically, in production environments, httpd is generally used to serve static assets and such and dynamic content would be served by Tomcat. Generally one would install mod_jk and use the jkMount directive to connect Tomcat to httpd via AJP, which is a lot faster being a binary protocol than using HTTP.
There used to be a much bigger difference in terms of performance, here.
Tomcat is able to serve static resources via its DefaultServlet pretty well these days.
For AJP setup, see the documentation here:
https://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html

Apache is listening on a different port, but how do I get it so I don't have to type in the port number?

I am running IIS and Apache HTTP Server side-by-side on my localhost machine, and Apache is listening on a different port (port 81). IIS is listening to port 80. However, I can only get to my virtual domains for Apache if I type in that port number. So for instance:
http://virtual.myvirtualdomain.com:81
http://virtual.myvirtualdomain2.com:81
How can I make it so Apache automatically knows it is port 81, and does not force me to type in the port number?
EDIT:
The answer appears to be that I need to redirect IIS to Apache. Can anyone provide clarification on how that is done with IIS 5.1?
It's not a matter of telling Apache, it's a matter of the browser knowing what to connect to. You're either going to have to have IIS redirect to Apache, or give up.
You have to type in the port number so your client knows where to connect to. This has nothing to do with the server.
On Unix systems you might be able to modify your /etc/services to list 81 as port for http. But that would effectively disable access to all websites that are located on port 80.
Alternatively you can configure your IIS on port 80 to locally proxy requests for the sites which are on apache. Then all clients would ask the IIS for a page, which would make a local connection to port 81.
I did some more research and it turns out that you can't redirect IIS 5.1 to Apache because that would require multiple Web sites (setup as redirects to the virtual hosts on Apache on port 81). This is because IIS 5.1 on Windows XP Pro can't do multiple Web sites (running at the same time without the scripting hack). Oh well.
How about you swap it? Make Apache listen on port 80, IIS on port 81 for whatever you need and have Apache redirect? Apache shouldn't be restricted to the same one-website per machine that IIS 5.1 is.
You can't. The 81 is telling your browser where to look for Apache.
You can't.
It's the job of your web client to specify the port, and until you do specify that port it won't even reach Apache.
What you could potentially do is have IIS also listen for the same HTTP/1.1 virtual hosts, and then arrange for it to issue a 302 Moved redirect to send your browser to the right port number.
Alternatively, run a second IP address on your machine, and bind IIS to the original IP address and Apache to the second. That way you don't need to use different ports at all.
There is no way to do exactly what you ask. About the only way would be to configure IIS -- for the virtual domains being served by IIS -- to forward to Apache on port 81. With this configuration, the client would not be aware that their requests were passing through IIS on their way to Apache. A little less efficient, but it would solve your needs.
When an url is typed, there is a certain port that the browser has to use to connect to the site. 80 is the default port that the server checks. If you need to connect to any other port via a browser, you would need to have the port number in the url. It is not apache that is forcing you to type 81, but rather your browser because it is set to use 80 as the port when a port number is not specified.
If you were to change apache's port to 80 and IIS port to 81, then you be able to connect to apache without the port number but you will need to use the port number when using the IIS webserver.
Not sure what the others idea is behind using apache to redirect to IIS. It sounds like to me that if you make an entry in httpd.conf of apache for IIS directory, then you be using apache to connect to the directory, not IIS.
You could set up a domain and have it connect to apache via port 81. That is one way to hide the port number (might be not true. I have never tried apache on port other than 80).