Win a copy of Head First Android this week in the Android forum!

Brandon Hofmann

Greenhorn
+ Follow
since Jan 30, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brandon Hofmann

UPDATE: I was able to get Tomcat to host my static html OUTSIDE of webapps using a new Host and Context element in my sever.xml:



The appBase defines the location of my static html and docBase defines the folder containing the website's specific html relative to appBase. The name and alias attributes define the domain name requests Tomcat will match and serve NOT DEPENDENT on the path of the URL.
6 years ago
Hello,

I have a VirtualBox Ubuntu Server with Java 8 and Tomcat 8. I want to use Tomcat to serve all web content using it's webapps directory for all my Java apps and create a webdocs directory at the same level and permissions for all my static html websites.

I also have security that checks each URL serving a login if necessary so serving my static html can't be based on the URL path. I want to replicate Apache2's ability to match a domain name and serve the associated docBase. The following is my server.xml attempting to add a Context Path for my static html within the Engine tag:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--


<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />

</Host>

<Host name="myets.us" appBase="webdocs">
<Alias>www.myets.us</Alias>
<Context path="" docBase="/mywebsql/" />
</Host>

I've tried variations of the above, but get 404 codes or access denied. I'm sure there is conflict with my web.xml where security is designed to intercept each URL. As I said, I need to keep security doing the same, but want domain names to resolve to the docBase similar to what Apache2 does.

Lastly, how can I use domain names instead of 192.168.x.x:8080/ to mimic my production server? Is there a way to do that on my laptop running VirtualBox?

Any help would be greatly appreciated.

Thanks,

Brandon

P.S. I know I have to setup my IPTable Rules to reroute 8080 to 80 and 8443 to 443 and next get multiple SSL certificates configured in Tomcat. I'm taking each of these configurations in steps.
6 years ago