Don't try to put both on the same port -- that'll never work. Put
tomcat on 8080, Squid on 80 and then reverse proxy the tomcat service
with Squid.
Then try this Squid config adapted from the Squid FAQ at
http://wiki.squid-cache.org/SquidFaq/ReverseProxy :
http_port 80 accel defaultsite=www.cetle.info
cache_peer 127.0.0.1 parent 8080 0 no-query originserver name=tomcatServer
acl publicSite dstdomain www.cetle.info
http_access allow publicSite
cache_peer_access tomcatServer allow publicSite
cache_peer_access tomcatServer deny all
--David
Adrian Butnaru wrote:
Still trying ... if I type www.cetle.info:8080 I can get Tomcat page.
So Tomcat is working. If I try to go to
www.cetle.info:8080/magnoliaPublic Squid is reporting Access denied.
Have anybody more experience to get this working?
A.
Adrian Butnaru schreef:
I corrected back the ports number in server.xml.
Added proxyPort and proxyName.
Still not able to access the website.
There is any other easiest way to make Tomcat working as webserver
for Magnolia or any other CMS?
David Smith schreef:
Don't change the ports numbers in server.xml. Tomcat still needs a
unique port number not occupied by Squid. The connector you are
proxying in server.xml should probably include proxyPort="80" and
proxyName="www.cetle.info" which causes the links generated by
tomcat to have the right domain name and port.
I haven't ever used Squid, so I don't know what that conf should
look like. When you are setting up, the key words to look for in
the docs are "reverse proxy". That's what you are trying to setup
with Squid in front of Tomcat.
--David
Adrian Butnaru wrote:
Hi,
I was very optimistic in the beginning but I still have some
problems so I still need some help.
I installed Squid.
I added the following in squid.conf:
http_port 80 accel defaultsite=www.mywebsite.info
cache_peer 85.XXX.XXX.XXX parent 80 0 no-query originserver
name=myAccel
acl our_sites dstdomain www.mywebsite.info http_access allow
our_sites cache_peer_access myAccel allow our_sites
I changed in server.xml:
Connector port from 8080 to 80.
The rest I left as it is by default in the file.
Then I uploaded magnoliaPublic and ROOT directory from my tomcat
server I am running successfully on my laptop.
Restarted Tomcat.
Restarted Squid.
When I type www.mywebsite.info/magnoliaPublic in the browser in
receive:
ERROR
The requested URL could not be retrieved
------------------------------------------------------------------------
While trying to retrieve the URL:
http://www.mywebsite.info/magnoliaPublic
<http://www.cetle.info/magnoliaPublic>
The following error was encountered:
* *Access Denied. *
Access control configuration prevents your request from being
allowed at this time. Please contact your service provider if you
feel this is incorrect.
Your cache administrator is root <mailto:root>.
David Smith schreef:
Ok.. that should work and provide a nice caching function. Most
tomcat people would say the most efficient design is to have
tomcat by itself listening on port 80. In Magnolia's case, the
caching system in Squid would probably provide a nice boost to
performance. My site is fronted by Apache Httpd and it's caching
system takes a load off the Magnolia system. Updates may not show
immediately depending on how long it takes Squid to check back
with tomcat and find out if things have changed. But if your site
is like a lot of sites, it only changes a little each day anyway.
Still ... definitely drop the GNU Java JVM -- it's not up to the
task of running a server environment. Alright for client
applications, but I wouldn't recommend it for a server.
jsvc is a little utility program that grabs the required
privileged ports, and then launches tomcat as process under the
user account you choose. That allows tomcat to get the low number
ports and run as an unprivileged user -- which makes admins like
me really happy :-).
--David
Adrian Butnaru wrote:
Thanks,
I am trying to use Squid in front of Tomcat now. I will also try
to use Sun's Java. I thought it will be more straightforward to
use Tomcat as a webserver.
I am not very sure how to use jsvc. I will dig a little the try
again installing Magnolia inside.
David Smith schreef:
Sorry, I'm a little handicapped in languages outside of
English.. Babelfish tells me the error is "Connection has been
refused" in Dutch. To connect to ports below 1024 in any of the
*nix OS's (Unlix/Linux/most outside of Windows), the user
starting tomcat has to be root or have root privilege on the
system. That's usually achieved using jsvc from the Apache
Commons Daemon project (http://commons.apache.org/daemon/)
although I'm sure you can find other ways with a little googling.
Other than that, I would highly recommend you replace your GNU
Java environment with a more server strength Java like the one
from Sun (http://java.sun.com). Your hosting provided should be
able to help with that.
--David
Adrian Butnaru wrote:
Thanks for the tips and comments.
I think is something wrong with my Tomcat.
Please help me if more experienced.
Verbinding is geveigerd = Access is denied.
Have you any ideea why?
This is my log catalina.out:
Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
Created MBeanServer with ID:
-pitlki:fkcu3gdh.0:h1408713.stratoserver.net:1
26-aug-08 20:10:52 org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Verbinding is geweigerd
at gnu.java.net.PlainSocketImpl.connect(libgcj.so.7rh)
at java.net.Socket.connect(libgcj.so.7rh)
at java.net.Socket.connect(libgcj.so.7rh)
at java.net.Socket.<init>(libgcj.so.7rh)
at java.net.Socket.<init>(libgcj.so.7rh)
at
org.apache.catalina.startup.Catalina.stopServer(catalina-5.5.23.jar.so)
at java.lang.reflect.Method.invoke(libgcj.so.7rh)
at
org.apache.catalina.startup.Bootstrap.stopServer(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
touch: kan touch `/usr/share/tomcat5/logs/catalina.out' niet
uitvoeren: Toegang geweigerd
/usr/bin/dtomcat5: line 325:
/usr/share/tomcat5/logs/catalina.out: Toegang geweigerd
David Smith schreef:
Hi Adrian.
2. Changed <Engine name="Catalina" defaultHost="localhost">
to
<Engine name="Catalina" defaultHost="www.mywebsite.info">
Not really necessary ... not wrong, just not necessary.
Localhost, which was declared as the default host in the Host
element above and would have naturally taken any request
without an explicitly matching Host element.
3. Changed <Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
to
<Host name="www.mywebsite.info"
appBase="webapps/magnoliaPublic" unpackWARs="true"
autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
Again, not necessary .... not wrong ... just unnecessary. See
above.
The name of the folder containing the application is
magnoliaPublic
Then you should be requesting
http://www.mywebsite.info/magnoliaPublic. If you want
magnoliaPublic to be the default webapp, it should be named
ROOT (case is important).
Your result (the blank page) may be because their is no ROOT
webapp or because of an exception processing the default
page. Hard to say what's happening at this point. You should
review your logs, both tomcat's and magnolia's for possible
sources of issues. Also check to be sure tomcat is listening
on port 80 as that's the default port web browsers contact
when you don't add a colon and port number after your domain
name in the URL.
--David
Adrian Butnaru wrote:
But is there any chance to make it working only woth Tomcat?
I really do not need Apache.
Adrian
Ruben Reusser schreef:
you probably would be better off installing apache in front
of tomcat and use a reverse proxy or mod_jk
Ruben
Adrian Butnaru wrote:
Hi I am a newbie trying to use Tomcat to run a website (e.g
www.mywebsite.info) on a Virtual Private Server (VPS). I
built the website using Magnolia CMS. My domain is
registered by the provider of the VPS. I uploaded my
application in the webapps folder. The name of the folder
containing the application is magnoliaPublic. I did the
following changes in server.xml:
1. Changed the Connector port from 8080 to 80.
2. Changed <Engine name="Catalina" defaultHost="localhost">
to
<Engine name="Catalina" defaultHost="www.mywebsite.info">
3. Changed <Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
to
<Host name="www.mywebsite.info"
appBase="webapps/magnoliaPublic" unpackWARs="true"
autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
If I try www.mywebsite.info in my browser I cannot see
nothing.
Can you please guide how to make my website working? Is it
something more I should do?
Thanks
A.
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
--
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------