apache2 and tomcat config
1.install apache2
2.instal apache2 jk
3.vim /etc/apache2/mods-available/jk.conf
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
#JkMount /* webstore
4.vim /etc/apache2/mods-available/jk.load
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
5.vim /etc/apache2/workers.properties
# Define 1 real worker using ajp13
worker.list=webstore,sandbox
# Set properties for webstore (ajp13)
worker.webstore.type=ajp13
worker.webstore.host=localhost
worker.webstore.port=8009
worker.webstore.lbfactor=50
worker.webstore.socket_timeout=300
worker.webstore.socket_keepalive=1
worker.webstore.connection_pool_size=20
worker.webstore.connection_pool_minsize=10
worker.webstore.connection_pool_timeout=600
worker.sandbox.type=ajp13
worker.sandbox.host=localhost
worker.sandbox.port=8010
worker.sandbox.lbfactor=50
worker.sandbox.socket_timeout=300
worker.sandbox.socket_keepalive=1
worker.sandbox.connection_pool_size=20
worker.sandbox.connection_pool_minsize=10
worker.sandbox.connection_pool_timeout=600
6.sudo ln -s /etc/apache2/mods-available/jk.conf /etc/apache2/mods-enabled/jk.conf
7.sudo ln -s /etc/apache2/mods-available/jk.conf /etc/apache2/mods-enabled/jk.conf
8.add a line to /etc/apache2/sites-available/default
JkMount /* webstore
9.vim /etc/apache2/sites-available/static
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName static.mycompany.com
DocumentRoot /var/www/static
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/static/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /var/www/static/picture/product/medium>
ErrorDocument 404 /picture/product/nopic-medium.jpg
</Directory>
<Directory /var/www/static/picture/product/large>
ErrorDocument 404 /picture/product/nopic-large.jpg
</Directory>
<Directory /var/www/static/picture/product/small>
ErrorDocument 404 /picture/product/nopic-small.jpg
</Directory>
SetEnvIf Request_URI "/*" no-jk
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
10.mkdir /var/www/static/
apache2 and tomcat config
最新推荐文章于 2024-07-24 15:25:36 发布