> cd /usr/local/ /usr/local/ > sudo unzip ~/Desktop/apache-tomcat-6.0.18 /usr/local/ > sudo ln -s apache-tomcat-6.0.18/ tomcat /usr/local/ > cd /usr/local/tomcat/bin /usr/local/tomcat/bin > sudo chmod +x *.sh
/usr/local/tomcat/bin > ./startup.sh
/usr/local/tomcat/bin > ./shutdown.sh
#! /bin/sh # chkconfig: 35 99 01 # description: Tomcat export JAVA_HOME="/usr/lib/jvm/java" export CATALINA_HOME="/usr/local/tomcat" case "$1" in start) $CATALINA_HOME/bin/satrtup.sh ;; stop) $CATALINA_HOME/bin/shutdown.sh sleep 3 ;; restart) $0 stop $0 start ;; *) echo "Usage tomcat [start|stop|restart]" esac
- export JAVA_HOME="/usr/lib/jvm/java" + export JAVA_HOME="/usr/lib/jvm/jdk1.6.0_16" + export JRE_HOME="/usr/lib/jvm/jdk1.6.0_16/jre"と変更した > Suse10 Java 6
> sudo chmod +x /etc/rc.d/tomcat > sudo /sbin/chkconfig --level 35 tomcat on > ls /etc/rc.d/rc5.d | grep tomcat K21tomcat S01tomcat
> ls /etc/rc.d/rc5.d/ | grep tomcat K21tomcat S01tomcat > ls /etc/rc.d/rc5.d/ | grep apache K04apache2 S18apache2
grape:/etc/apache2 # cat sysconfig.d/loadmodule.conf # # Files in this directory are created at apache start time by /usr/sbin/rcapache2. # Do not edit them! # # as listed in APACHE_MODULES (/etc/sysconfig/apache2) LoadModule access_module /usr/lib/apache2-prefork/mod_access.so LoadModule actions_module /usr/lib/apache2-prefork/mod_actions.so LoadModule alias_module /usr/lib/apache2-prefork/mod_alias.so LoadModule auth_module /usr/lib/apache2-prefork/mod_auth.so LoadModule autoindex_module /usr/lib/apache2-prefork/mod_autoindex.so LoadModule cgi_module /usr/lib/apache2-prefork/mod_cgi.so LoadModule dir_module /usr/lib/apache2-prefork/mod_dir.so LoadModule include_module /usr/lib/apache2-prefork/mod_include.so LoadModule log_config_module /usr/lib/apache2-prefork/mod_log_config.so LoadModule mime_module /usr/lib/apache2-prefork/mod_mime.so LoadModule negotiation_module /usr/lib/apache2-prefork/mod_negotiation.so LoadModule setenvif_module /usr/lib/apache2-prefork/mod_setenvif.so LoadModule status_module /usr/lib/apache2-prefork/mod_status.so LoadModule userdir_module /usr/lib/apache2-prefork/mod_userdir.so LoadModule asis_module /usr/lib/apache2-prefork/mod_asis.so LoadModule deflate_module /usr/lib/apache2-prefork/mod_deflate.so LoadModule imap_module /usr/lib/apache2-prefork/mod_imap.so LoadModule ssl_module /usr/lib/apache2-prefork/mod_ssl.so LoadModule php4_module /usr/lib/apache2-prefork/libphp4.so LoadModule perl_module /usr/lib/apache2/mod_perl.so LoadModule python_module /usr/lib/apache2/mod_python.so LoadModule ruby_module /usr/lib/apache2/mod_ruby.so LoadModule jk_module /usr/lib/apache2/mod_jk.so # grape:/etc/apache2 #追記:loadmodule.conf には、しっかり Do not edit them! ってかいてありますな ・・・ apache 起動時に毎回 /etc/sysconfig/apache2 の APACHE_MODULES の記述内容から loadmodule.conf が作られるようです
> cat /etc/sysconfig/apache2 | grep MODULES # * In the APACHE_MODULES variable, you can use mod_xyz or just xyz syntax. # APACHE_MODULES="access alias auth dir log_config mime setenvif" # APACHE_MODULES="access actions alias asis auth autoindex cgi dir imap include log_config mime negotiation setenvif status userdir" APACHE_MODULES="access actions alias auth autoindex cgi dir include log_config mime negotiation setenvif status userdir asis deflate imap ssl php4 perl python ruby jk"
grape:/etc/apache2 # cat conf.d/mod_jk.conf <IfModule mod_jk.c> JkWorkersFile /etc/apache2/workers.properties JkLogFile /var/log/apache2/mod_jk.log JkLogLevel error # ========== /examples/* ========== Alias /examples "/usr/local/tomcat/webapps/examples" <Directory "/usr/local/tomcat/webapps/examples"> Options Indexes FollowSymLinks allow from all </Directory> JkMount /examples/* tomcat1 <Location "/examples/WEB-INF"> AllowOverride None deny from all </Location> # ========== /docs/* ========== Alias /docs "/usr/local/tomcat/webapps/docs" <Directory "/usr/local/tomcat/webapps/docs"> Options Indexes FollowSymLinks allow from all </Directory> JkMount /docs/* tomcat1 <Location "/docs/WEB-INF"> AllowOverride None deny from all </Location> </IfModule> grape:/etc/apache2 #
grape:/etc/apache2 # cat workers.properties worker.list=tomcat1 worker.tomcat1.port=8009 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 grape:/etc/apache2 #
grape:/etc/apache2 # cat -n /usr/local/tomcat/conf/server.xml | head -90 | tail -35 56 maxThreads="150" minSpareThreads="4"/> 57 --> 58 59 60 <!-- A "Connector" represents an endpoint by which requests are received 61 and responses are returned. Documentation at : 62 Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) 63 Java AJP Connector: /docs/config/ajp.html 64 APR (HTTP/AJP) Connector: /docs/apr.html 65 Define a non-SSL HTTP/1.1 Connector on port 8080 66 --> 67 <Connector port="8080" protocol="HTTP/1.1" 68 connectionTimeout="20000" 69 redirectPort="8443" /> 70 <!-- A "Connector" using the shared thread pool--> 71 <!-- 72 <Connector executor="tomcatThreadPool" 73 port="8080" protocol="HTTP/1.1" 74 connectionTimeout="20000" 75 redirectPort="8443" /> 76 --> 77 <!-- Define a SSL HTTP/1.1 Connector on port 8443 78 This connector uses the JSSE configuration, when using APR, the 79 connector should be using the OpenSSL style configuration 80 described in the APR documentation --> 81 <!-- 82 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 83 maxThreads="150" scheme="https" secure="true" 84 clientAuth="false" sslProtocol="TLS" /> 85 --> 86 87 <!-- Define an AJP 1.3 Connector on port 8009 --> 88 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 89 90 grape:/etc/apache2 #
kagyuu@grape:/usr/local/tomcat/conf> cat tomcat-users.xml <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <user username="root" password="password" roles="manager"/> </tomcat-users> kagyuu@grape:/usr/local/tomcat/conf>manager ロールのユーザを一つ作っておく
kagyuu@grape:/usr/local/tomcat/conf> sudo vi /etc/apache2/conf.d/mod_jk.conf Password: 34 </Location> 35 36 # ========== /ExamWebService/* ========== 37 38 Alias /ExamWebService "/usr/local/tomcat/webapps/ExamWebService" 39 <Directory "/usr/local/tomcat/webapps/ExamWebService"> 40 Options Indexes FollowSymLinks 41 allow from all 42 </Directory> 43 44 JkMount /ExamWebService/* tomcat1 45 46 <Location "/ExamWebService/WEB-INF"> 47 AllowOverride None 48 deny from all 49 </Location> 50 51 </IfModule>
kagyuu@grape:/usr/local/tomcat/conf> sudo /etc/rc.d/apache2 restart Password: Syntax OK Shutting down httpd2 (waiting for all children to terminate) done Starting httpd2 (prefork) done kagyuu@grape:/usr/local/tomcat/conf>