Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Will somebody give me a clue?? {Apache, Tomcat, mod_jk-1box}
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
sneakyme66
n00b
n00b


Joined: 02 Jan 2004
Posts: 43

PostPosted: Tue Apr 21, 2009 1:49 pm    Post subject: Will somebody give me a clue?? {Apache, Tomcat, mod_jk-1box} Reply with quote

I'm having some problems with this recent setup,
->Apache->mod_jk->tomcat

When I access a site, say host.com/assign5, which is a tomcat dir, I get html as text
when I go to it through tomcat host.com:8080/assign5, I get redirected to host.com:8080/assign5/index.html

Index in this case is a servlet

Also---------------
How can I get SSL working cheapest??


THANKS
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Tue Apr 21, 2009 3:12 pm    Post subject: Reply with quote

if you havent changet the configuration, then host.com/assign5 is not tomcat.
so, I demand more info about your configuration, like tomcat version, config file, etc.


and... did you try assign.html? what is your servlet mapping anyway?

for ssl I would hit the wiki: http://www.mbaworld.com/docs/ssl-howto.html
Back to top
View user's profile Send private message
sneakyme66
n00b
n00b


Joined: 02 Jan 2004
Posts: 43

PostPosted: Tue Apr 21, 2009 3:31 pm    Post subject: Reply with quote

I'm running trac and trying to use tomcat to host an ssl auction website for school. Thanks

www-servers/tomcat-6.0.18-r3 USE="-doc -examples -source -test"

www-servers/apache-2.2.11 USE="ldap* ssl -debug -doc (-selinux) -sni -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"


88_mod_jk.conf
[code]
<IfDefine JK>
LoadModule jk_module modules/mod_jk.so

JkWorkersFile /etc/apache2/workers.properties
JkShmFile /var/log/apache2/mod_jk.shm

JkLogFile /var/log/apache2/mod_jk.log


JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkOptions +ForwardSSLCertChain +ForwardKeySize +ForwardURICompat +ForwardDirectories

JkRequestLogFormat "%w %V %p %T %b %B %H %m %q %r"
JkMountFile /etc/apache2/uriworkermap.properties

JkAutoAlias /var/lib/tomcat-6/webapps/

</IfDefine>
[/code]

uriworkermap.properties
[code]
/assign5*=ajp13
[/code]

workers.properties
[code]
workers.tomcat_home=/usr/share/tomcat-6
workers.java_home=/opt/sun-jdk-1.6.0.13
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp13
[/code]

default_vhost.include
[code]
ServerAdmin root@secServer
DocumentRoot "/var/www/localhost/htdocs"
<Directory "/var/www/localhost/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"
</IfModule>
<Directory "/var/www/localhost/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
Alias /trac "/var/www/localhost/htdocs/trac/"
<Location "/trac">
SetEnv PYTHON_EGG_CACHE /var/lib/trac/egg-cache
SetHandler mod_python
PythonPath "sys.path + ['/var/lib/trac']"
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/lib/trac/my_proj
PythonOption TracUriRoot /trac
</Location>
<Location "/trac/my_proj/login">
AuthType Basic
AuthName "Trac Server"
AuthUserFile /var/svn/conf/svnusers
Require valid-user
</Location>

Alias /cs5300 "/var/lib/tomcat-6/webapps/assign5"
<Location "/cs5300/*">
SetHandler jakarta-servlet
#JkMount ajp13
#SetEnv JK_WORKER_NAME ajp13
Order allow,deny
Allow from all
</Location>
Alias /assign5 "/var/lib/tomcat-6/webapps/assign5"
<Location "/assign5/*">
SetHandler jakarta-servlet
#JkMount ajp13
#SetEnv JK_WORKER_NAME ajp13
Order allow,deny
Allow from all
</Location>
[/code]

00_default_vhost.conf
[code]
<IfDefine DEFAULT_VHOST>
Listen 80
NameVirtualHost *:80
JkMountCopy All
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include

#JkMount /assign5* ajp13
JkAutoAlias /var/lib/tomcat-6/webapps/
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
</IfDefine>
[/code]

00_default_ssl_vhost.conf
[code]
<IfDefine SSL>
<IfDefine SSL_DEFAULT_VHOST>
<IfModule ssl_module>
Listen 443
JkMountCopy All
<VirtualHost *:443>
ServerName ********
Include /etc/apache2/vhosts.d/default_vhost.include
ErrorLog /var/log/apache2/ssl_error_log
JkAutoAlias /var/lib/tomcat-6/webapps/
<IfModule log_config_module>
TransferLog /var/log/apache2/ssl_access_log
</IfModule>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory "/var/www/localhost/cgi-bin">
SSLOptions +StdEnvVars
</Directory>

<IfModule setenvif_module>
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</IfModule>

<IfModule log_config_module>
CustomLog /var/log/apache2/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</IfModule>
</VirtualHost>
</IfModule>
</IfDefine>
</IfDefine>
[/code]
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Tue Apr 21, 2009 6:15 pm    Post subject: Reply with quote

ok...
what about web.xml?

I was wondering, what do you mean with: "I get html as text" paste or screenshot to help me pls
If I get you right, assign5 is a tomcat directory in /var/lib/tomcat-6/webapps, this means it is a web application, right? if so, that it is normal that you get redirected to the index.html page, since it is the default action. You can redefine it in your web.xml in /var/lib/tomcat-6/webapps/assing5/ I would suggest that you install tomcat with doc and examples enabled, restart tomcat, and open http://localhost:8080/ It will explain somewhat how the thing works.

btw, you havent updated your www-servers/apache, the * after ldap helped me guess it.

ps: All I can help you is about tomcat, since I used apache for the last time 5-6 years ago...
Back to top
View user's profile Send private message
sneakyme66
n00b
n00b


Joined: 02 Jan 2004
Posts: 43

PostPosted: Tue Apr 21, 2009 7:44 pm    Post subject: Reply with quote

What I'm saying about the index.html (index servlet) is that firefox shows this... instead of the actual page. When going to http://host/assign5. But, when going to http://host:8080/assign5 I get the actual page that this represents.

Thanks for the ssl guide! Got any other security related tips? (btw this is not the same project that will be in ssl) If I put my mysql my.cnf, "skip-networking" how do I connect to the db in a java servlet? Also, best way to do user authentication and where to store DB passwords?

You're right, assign5 is in my tomcat webapps dir. Here's my web.xml from the assign5 WEB-INF dir. What is the difference in that web.xml and the one in the tomcat conf dir?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Index</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<p>
<h1>Returning User Login:</h1>
<form method=POST action="dologin">
UserName: <input type=text name=uname size=25 maxlength=25>
<br>
Password: <input type=password name=pwd size=25 maxlength=25>
<br><input type=submit value=login>
</form>
<p>&nbsp;<p>&nbsp;
<h2>New User Signup:</h2>
<p>
<form method=POST action="dosignup">
UserName: <input type=text name=uname size=25 maxlength=25>
<br>
Password: <input type=password name=pwd size=25 maxlength=25>
<br><input type=submit value=signup>
</form>
</BODY></HTML>


[post=]
<?xml version="1.0" encoding="UTF-8" ?>
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>assign3</display-name>
- <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
- <servlet>
<description />
<display-name>index</display-name>
<servlet-name>index</servlet-name>
<servlet-class>index</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>index</servlet-name>
<url-pattern>/index.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>dologin</display-name>
<servlet-name>dologin</servlet-name>
<servlet-class>dologin</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>dologin</servlet-name>
<url-pattern>/dologin</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>dosignup</display-name>
<servlet-name>dosignup</servlet-name>
<servlet-class>dosignup</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>dosignup</servlet-name>
<url-pattern>/dosignup</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>prefs</display-name>
<servlet-name>prefs</servlet-name>
<servlet-class>prefs</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>prefs</servlet-name>
<url-pattern>/prefs.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doprefs</display-name>
<servlet-name>doprefs</servlet-name>
<servlet-class>doprefs</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doprefs</servlet-name>
<url-pattern>/doprefs</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doallimages</display-name>
<servlet-name>doallimages</servlet-name>
<servlet-class>doallimages</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doallimages</servlet-name>
<url-pattern>/doallimages</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>logout</display-name>
<servlet-name>logout</servlet-name>
<servlet-class>logout</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>logout</servlet-name>
<url-pattern>/logout</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>acct</display-name>
<servlet-name>acct</servlet-name>
<servlet-class>acct</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>acct</servlet-name>
<url-pattern>/acct.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>addimage</display-name>
<servlet-name>addimage</servlet-name>
<servlet-class>addimage</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>addimage</servlet-name>
<url-pattern>/addimage.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doaddimage</display-name>
<servlet-name>doaddimage</servlet-name>
<servlet-class>doaddimage</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doaddimage</servlet-name>
<url-pattern>/doaddimage</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>showimagesfound</display-name>
<servlet-name>showimagesfound</servlet-name>
<servlet-class>showimagesfound</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>showimagesfound</servlet-name>
<url-pattern>/showimagesfound.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>domyimages</display-name>
<servlet-name>domyimages</servlet-name>
<servlet-class>domyimages</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>domyimages</servlet-name>
<url-pattern>/domyimages</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>showmyimagesfound</display-name>
<servlet-name>showmyimagesfound</servlet-name>
<servlet-class>showmyimagesfound</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>showmyimagesfound</servlet-name>
<url-pattern>/showmyimagesfound.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>showimage</display-name>
<servlet-name>showimage</servlet-name>
<servlet-class>showimage</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>showimage</servlet-name>
<url-pattern>/showimage.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>showmyimage</display-name>
<servlet-name>showmyimage</servlet-name>
<servlet-class>showmyimage</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>showmyimage</servlet-name>
<url-pattern>/showmyimage.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doaddcart</display-name>
<servlet-name>doaddcart</servlet-name>
<servlet-class>doaddcart</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doaddcart</servlet-name>
<url-pattern>/doaddcart</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>MyCart</display-name>
<servlet-name>MyCart</servlet-name>
<servlet-class>MyCart</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>MyCart</servlet-name>
<url-pattern>/MyCart.html</url-pattern>
<url-pattern>/cart.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>orders</display-name>
<servlet-name>orders</servlet-name>
<servlet-class>orders</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>orders</servlet-name>
<url-pattern>/orders.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doeditmyimage</display-name>
<servlet-name>doeditmyimage</servlet-name>
<servlet-class>doeditmyimage</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doeditmyimage</servlet-name>
<url-pattern>/doeditmyimage</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>dobuynow</display-name>
<servlet-name>dobuynow</servlet-name>
<servlet-class>dobuynow</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>dobuynow</servlet-name>
<url-pattern>/dobuynow</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>doprocessorderstep</display-name>
<servlet-name>doprocessorderstep</servlet-name>
<servlet-class>doprocessorderstep</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>doprocessorderstep</servlet-name>
<url-pattern>/doprocessorderstep</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>processorderstep</display-name>
<servlet-name>processorderstep</servlet-name>
<servlet-class>processorderstep</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>processorderstep</servlet-name>
<url-pattern>/processorderstep.html</url-pattern>
</servlet-mapping>
- <servlet>
<description />
<display-name>db</display-name>
<servlet-name>db</servlet-name>
<servlet-class>db</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>db</servlet-name>
<url-pattern>/db</url-pattern>
</servlet-mapping>
</web-app>
[/post]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum