1、ProxyPass
ProxyPass /favicon.ico ! :favicon.ico不做代理
ProxyPass / http://localhost:7001/ :全部代理到jetty的7001端口
[注意]有先后顺序的区别
- <IfModule mod_proxy.c>
- ProxyRequests Off
- ProxyPreserveHost On
- ProxyErrorOverride On
- <Directory proxy:*>
- Order deny,allow
- Allow from all
- </Directory>
- ProxyPass /favicon.ico !
- ProxyPass / http://localhost:7001/
- SetEnv force-proxy-request-1.0 1
- SetEnv proxy-nokeepalive 1
- </IfModule>
2、静态模块与动态模块
静态模块:apache安装的时候,放在httpd/modules/下面,在apache启动的时候强制加载的。
动态模块:动态编译的,不再apache安装目录的模块下面,通过httpd -l进行查看。在使用的时候,使用配置文件的IfModule指令进行动态加载。例如:
- [admin@server ~]$ ./httpd -l
- Compiled in modules:
- core.c
- mod_access.c
- mod_auth.c
- mod_include.c
- mod_deflate.c
- mod_log_config.c
- mod_env.c
- mod_expires.c
- mod_headers.c
- mod_setenvif.c
- mod_proxy.c
- proxy_connect.c
- proxy_ftp.c
- proxy_http.c
- worker.c
- http_core.c
- mod_mime.c
- mod_status.c
- mod_autoindex.c
- mod_asis.c
- mod_cgid.c
- mod_negotiation.c
- mod_dir.c
- mod_imap.c
- mod_actions.c
- mod_userdir.c
- mod_alias.c
- mod_rewrite.c
- mod_so.c
3、apache的启动与停止
HTTPD="$HTTPD_HOME/bin/httpd -f $WEB_APP_HOME/conf/httpd.conf"
- #!/bin/bash
- ARGV="$@"
- BASE_BIN_DIR=`dirname $0`
- . $BASE_BIN_DIR/env.sh
- HTTPD="$HTTPD_HOME/bin/httpd -f $WEB_APP_HOME/conf/httpd.conf"
- LOG_DIR=$OUTPUT_HOME/logs
- if [ ! -d $LOG_DIR ]; then
- mkdir -p $LOG_DIR
- fi
- # pick up any necessary environment variables
- if [ -f $HTTPD_HOME/bin/envvars ]; then
- . $HTTPD_HOME/bin/envvars
- fi
- LYNX="lynx -dump"
- STATUSURL="http://localhost/serverstatus"
- ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
- if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
- $ULIMIT_MAX_FILES
- fi
- ERROR=0
- if [ "x$ARGV" = "x" ] ; then
- ARGV="-h"
- fi
- case $ARGV in
- start|stop|restart|graceful)
- $HTTPD -k $ARGV
- ERROR=$?
- ;;
- startssl|sslstart|start-SSL)
- $HTTPD -k start -DSSL
- ERROR=$?
- ;;
- configtest)
- $HTTPD -t
- ERROR=$?
- ;;
- status)
- $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
- ;;
- fullstatus)
- $LYNX $STATUSURL
- ;;
- *)
- $HTTPD $ARGV
- ERROR=$?
- esac
- exit $ERROR
【注】执行 httpd -k install 命令,把Apache安装为Windows服务。接着, httpd -k start ,启动Apache。