tomcat7 配置

引用:http://blog.csdn.net/mengxiangbaidu/article/details/7020484

1.安装JDK,

2.安装,

  1. apt-get install  tomcat7

3.tomcat7的几个目录

  1. /usr/share/tomcat7
  2. /var/lib/tomcat7/
  3. /etc/tomcat7
  1. root@coder-671T-M:/usr/share/tomcat7# tree
  2. .
  3. ├── bin
  4. │   ├── bootstrap.jar
  5. │   ├── catalina.sh
  6. │   ├── catalina-tasks.xml
  7. │   ├── configtest.sh
  8. │   ├── digest.sh
  9. │   ├── setclasspath.sh
  10. │   ├── shutdown.sh
  11. │   ├── startup.sh
  12. │   ├── tomcat-juli.jar -> ../../java/tomcat-juli.jar
  13. │   ├── tool-wrapper.sh
  14. │   └── version.sh
  15. ├── conf -> /etc/tomcat7
  16. ├── defaults.md5sum
  17. ├── defaults.template
  18. ├── lib
  19. │   ├── annotations-api.jar -> ../../java/tomcat-annotations-api-7.0.21.jar
  20. │   ├── catalina-ant.jar -> ../../java/catalina-ant-7.0.21.jar
  21. │   ├── catalina-ha.jar -> ../../java/tomcat-catalina-ha-7.0.21.jar
  22. │   ├── catalina.jar -> ../../java/tomcat-catalina-7.0.21.jar
  23. │   ├── catalina-tribes.jar -> ../../java/catalina-tribes-7.0.21.jar
  24. │   ├── commons-dbcp.jar -> ../../java/commons-dbcp.jar
  25. │   ├── commons-pool.jar -> ../../java/commons-pool.jar
  26. │   ├── el-api.jar -> ../../java/tomcat-el-api-2.2.jar
  27. │   ├── jasper-el.jar -> ../../java/tomcat-jasper-el-7.0.21.jar
  28. │   ├── jasper.jar -> ../../java/tomcat-jasper-7.0.21.jar
  29. │   ├── jsp-api.jar -> ../../java/tomcat-jsp-api-2.2.jar
  30. │   ├── servlet-api.jar -> ../../java/tomcat-servlet-api-3.0.jar
  31. │   ├── tomcat-api.jar -> ../../java/tomcat-api-7.0.21.jar
  32. │   ├── tomcat-coyote.jar -> ../../java/tomcat-coyote-7.0.21.jar
  33. │   ├── tomcat-i18n-es.jar -> ../../java/tomcat-i18n-es-7.0.21.jar
  34. │   ├── tomcat-i18n-fr.jar -> ../../java/tomcat-i18n-fr-7.0.21.jar
  35. │   ├── tomcat-i18n-ja.jar -> ../../java/tomcat-i18n-ja-7.0.21.jar
  36. │   └── tomcat-util.jar -> ../../java/tomcat-util-7.0.21.jar
  37. ├── logs -> /var/lib/tomcat7
  38. └── webapps
  39. 5 directories, 31 files
  40. root@coder-671T-M:/var/lib/tomcat7# tree
  41. .
  42. ├── catalina.2011-11-28.log
  43. ├── catalina.out
  44. ├── common
  45. │   └── classes
  46. ├── conf -> /etc/tomcat7
  47. ├── localhost.2011-11-28.log
  48. ├── localhost_access_log.2011-11-28.txt
  49. ├── logs -> ../../log/tomcat7
  50. ├── server
  51. │   └── classes
  52. ├── shared
  53. │   └── classes
  54. ├── webapps
  55. │   ├── index.html
  56. │   └── ROOT
  57. │       ├── index.html
  58. │       └── META-INF
  59. │           └── context.xml
  60. └── work -> ../../cache/tomcat7
  61. 12 directories, 7 files
  1. root@coder-671T-M:/etc/tomcat7# tree
  2. .
  3. ├── Catalina
  4. │   └── localhost
  5. ├── catalina.properties
  6. ├── context.xml
  7. ├── logging.properties
  8. ├── policy.d
  9. │   ├── 01system.policy
  10. │   ├── 02debian.policy
  11. │   ├── 03catalina.policy
  12. │   ├── 04webapps.policy
  13. │   └── 50local.policy
  14. ├── server.xml
  15. ├── tomcat-users.xml
  16. └── web.xml
  17. 3 directories, 11 files

4. tomcat7的几个命令

  1. root@coder-671T-M:/var/lib/tomcat7# /etc/init.d/tomcat7 start
  2. * Starting Tomcat servlet engine tomcat7                                [ OK ]
  3. root@coder-671T-M:/var/lib/tomcat7# /etc/init.d/tomcat7 restart
  4. * Stopping Tomcat servlet engine tomcat7                                [ OK ]
  5. * Starting Tomcat servlet engine tomcat7                                [ OK ]
  6. root@coder-671T-M:/var/lib/tomcat7# /etc/init.d/tomcat7 stop
  7. * Stopping Tomcat servlet engine tomcat7                                [ OK ]
  8. root@coder-671T-M:/var/lib/tomcat7# /etc/init.d/tomcat7 start
  9. * Starting Tomcat servlet engine tomcat7                                [ OK ]
  10. root@coder-671T-M:/var/lib/tomcat7#
  11. /usr/share/tomcat7# /usr/share/tomcat7/bin/shutdown.sh
  12. /usr/share/tomcat7# /usr/share/tomcat7/bin/startup.sh

5.tomcat的网站目录,默认是

  1. root@coder-671T-M:/usr/share/tomcat7-root# ll
  2. 总用量 20
  3. drwxr-xr-x   3 root root  4096 2011-11-28 15:35 ./
  4. drwxr-xr-x 409 root root 12288 2011-11-28 15:35 ../
  5. drwxr-xr-x   3 root root  4096 2011-11-28 15:35 default_root/
  6. root@coder-671T-M:/usr/share/tomcat7-root# tree
  7. .
  8. └── default_root
  9. ├── index.html
  10. └── META-INF
  11. └── context.xml
  12. 2 directories, 2 files
  13. root@coder-671T-M:/usr/share/tomcat7-root#

而不是webapps

6.修改tomcat的访问端口为80

(1)更改/etc/tomcat7/server.xml中的

<Connector port="80" protocol="HTTP/1.1"  connectionTimeout="20000"  URIEncoding="UTF-8"            redirectPort="8443" />

(2)从ubuntu10.04起,默认是关闭1024一下的端口.需要手工打开,可以到编辑/etc/default/tomcat7中的最后一行AUTHBIND=yes来实现

默认是#AUTHBIND=no

具体操作步骤如下:

-、sudo vi /etc/tomcat7/server.xml,修改为port="80"

-、sudo vi /etc/default/tomcat7 ,修改为AUTHBIND=yes

-、sudo /etc/init.d/tomcat7 restart,进行重新启动

-、netstat -ant,查看80端口是否起来

上一篇:TextView和EditText中的setFilters方法说明


下一篇:EditText输入为空button不可点击搜索