How to run Apache Tomcat and Apache2 on Ubuntu Parallel to each other?
I have run into a problem. I do both pHp development and JSF development. But i ran into a problem. You see, a while ago I installed Apache2 so that I could do pHp. But then a month later I had to install Apache Tomcat. That's when the problem arose. I followed all the instruction give on the tomcat.apache.org
site for Ubuntu. It did not install. And 127.0.0.1
always pointed to Apache2's page. I tried 127.0.0.1:8080
but that did not return anything.
So I am here to ask you if there is anyway I can turn开发者_如何转开发 off Apache2 when i want to work with Tomcat? And turn it back on whenever I want?
The two servers should be configured to listen on different ports if you want them both available on the same host.
- Instructions for changing ports for Apache2 on Ubuntu
- Instructions for changing ports for Apache Tomcat on Ubuntu
Now, if you've configured Apache to listen on 80 and Tomcat to listen on port 8080, you should be able to access them at http://localhost:80 (or just http://localhost) and http://localhost:8080 respectively.
You should ensure both the servers are actually up as well. netstat -npl | grep :8080
and netstat -npl | grep :80
should help you identify what processes are bound to these two ports. If the ports are bound but don't say java
or apache2
, you've got some other process listening on these ports and that's going to stop the server that tries to bind to that port from starting up.
For Apache2, you could also run service apache2 status
to see what the status is.
If however, you want to run both servers bound to the same port( perhaps 80) then as you seem to have guessed, you'll have to stop the other.
- To stop Apache2, execute the command
service apache2 stop
- Stopping Tomcat depends on how you started it. You might simply run the
shutdown.sh
script in${CATALINA_HOME}/bin
i.e. thebin
directory in your Tomcat installation folder.
Note
You will [probably] need to execute the commands as root so you'll need to prefix sudo
.
精彩评论