Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using Apache Tomcat 8.0.15 on Linux Slackware 14.1. I have a server with multiple URLs. In $CATALINA_HOME/webapps I have separate app directories corresponding to each of these URLs.
How to I configure things so that a user just has to type the URL and gets the right app? For example:
I am using Apache Tomcat 8.0.15 on Linux Slackware 14.1. I have a server with multiple URLs. In $CATALINA_HOME/webapps I have separate app directories corresponding to each of these URLs.
How to I configure things so that a user just has to type the URL and gets the right app? For example:
If you want to set thisApp as the default tomcat webapp, then you should (re)move the ROOT directory and then rename thisApp to ROOT.
Of course you need to restart tomcat afterwards.
I'm also using Apache httpd, and have the following httpd-tomcat.conf
Code:
# Load mod_jk module
LoadModule jk_module lib64/httpd/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/workers.properties
# Where to put jk shared memory
JkShmFile /var/log/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /thisgroup/* worker1
JkMount /thisgroup worker1
JkMount /thatgroup/* worker2
JkMount /thatgroup worker2
I would think that the JkMount attribute would tell Tomcat where to go.
Also, I do have this already working for another website. All users have to do is type into their browser http://www.mydom.com and they get the webapp in $CATALINA_HOME/webapps/mydom (without even the .com at the end). I've looked through httpd.conf, workers.properties, httpd-tomcat.conf, web.xml, server.xml, and I cannot for the life of me see what is set to make this work. It must be something simple as I figured it out once (perhaps with help), but didn't write down the solution, probably because it seemed so obvious at the time.
Think about this.
What happens if we just type http://your_server_ip ?
What should we get?
Not sure I get what you're asking, but here's the real-world example (a public site, so not a problem). The one that works is http://www.cantleysauto.com. Type that in and you get right to the website. The .jsp programs for this site are located in $CATALINA_HOME/webapps/cantleys/
That's what I'm trying to re-create! Sadly, I forget how I accomplished that.
The IP for that site is 108.66.178.143. typing in http:/108.66.178.143 gives a 403 error from Tomcat ... but I'm not sure why that's interesting. Explain?
The one that works is http://www.cantleysauto.com. Type that in and you get right to the website. The .jsp programs for this site are located in $CATALINA_HOME/webapps/cantleys/
That's what I'm trying to re-create! Sadly, I forget how I accomplished that.
This is an apache web server acting as a reverse proxy for the tomcat server running the cantleys webapp.
So, take a look at the apache vhost config file to see how the vhost www.cantleysauto.com is configured and do the same for the rest of your webapps and vhosts
This is an apache web server acting as a reverse proxy for the tomcat server running the cantleys webapp.
So, take a look at the apache vhost config file to see how the vhost www.cantleysauto.com is configured and do the same for the rest of your webapps and vhosts
Regards
I thought of that, but httpd-vhosts.conf is not configured or included in httpd.conf
I thought of that, but httpd-vhosts.conf is not configured or included in httpd.conf
No <VirtualHost>'s configured in httpd.conf
If there are no vhosts defined, then I guess that each of your sites (http://www.thisgroup.org, http://www.thatgroup.org. http://www.anothergroup.org, etc) is served by a different apache installation and thus they are all listening on different IPs.
Can you verify that the 3 websites above are configured on different IPs?
If there are no vhosts defined, then I guess that each of your sites (http://www.thisgroup.org, http://www.thatgroup.org. http://www.anothergroup.org, etc) is served by a different apache installation and thus they are all listening on different IPs.
Can you verify that the 3 websites above are configured on different IPs?
I don't have the 3 sites configures yet. Only one. I'm trying to get this one going first. In the end, they will all have the same IP. Why can't I get the one site working with URL only and no app folder reference? I have exactly that working with cantleys site I referenced:
Here are all the configs for the cantleys site -- maybe something in there explains why this works:
httpd.conf (LoadModule not included)
Code:
ServerRoot "/usr"
Listen 80
Include /etc/httpd/extra/tomcat.conf
<IfModule unixd_module>
User cantleys
Group cantleys
</IfModule>
ServerAdmin mfoley@novatec-inc.com
ServerName www.cantleysauto.com
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
DocumentRoot "/usr/local/apache/htdocs"
<Directory "/usr/local/apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "/usr/local/apache/logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{User-Agent}i\"" marks
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "/usr/local/apache/logs/access_log" marks
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/srv/httpd/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/usr/local/apache/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/httpd/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include /etc/httpd/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
extra/proxy-html.conf
Code:
ProxyHTMLLinks a href
ProxyHTMLLinks area href
ProxyHTMLLinks link href
ProxyHTMLLinks img src longdesc usemap
ProxyHTMLLinks object classid codebase data usemap
ProxyHTMLLinks q cite
ProxyHTMLLinks blockquote cite
ProxyHTMLLinks ins cite
ProxyHTMLLinks del cite
ProxyHTMLLinks form action
ProxyHTMLLinks input src usemap
ProxyHTMLLinks head profile
ProxyHTMLLinks base href
ProxyHTMLLinks script src for
ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
onmouseover onmousemove onmouseout onkeypress \
onkeydown onkeyup onfocus onblur onload \
onunload onsubmit onreset onselect onchange
WAIT A MINUTE!!! It seems to be working now. Did I fix something? Did I merely refresh the browser? No idea. Now, to move onto the next step -- multiple sites to the same IP. I'll test than and post back.
WAIT A MINUTE!!! It seems to be working now. Did I fix something? Did I merely refresh the browser?
Might have been cached in the browser. a forced Reload (Shift+Reload button) on the page in Firefox always forces cache to be refreshed with
fresh content from the server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.