1、全部软件包一键安装命令如下: [root@localhost ~]# yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel mysql-connector-odbc mysql-devel libdbi-dbd-mysql tomcat6 tomcat6-webapps tomcat6-admin-webapps tomcat6-docs-webapp 2、重启Apache、MySQL、Tomcat服务: [root@localhost ~]# service httpd start Starting httpd: [ OK ] [root@localhost ~]# service mysqld start Starting mysqld: [ OK ] [root@localhost ~]# service tomcat6 start Starting tomcat6: [ OK ] 在Apache的网站根目录下(默认为/var/www/html/) 3.在浏览器输入http://你的IP:8080,可以看到Apache SoftWare Foundation页面 4、Apache与Tomcat的整合: 如果网站需同时整合Apache与Tomcat可以使用JK或者Proxy方式,使用vim编辑proxy_ajp.conf文件: # vim /etc/httpd/conf.d/proxy_ajp.conf 输入以下内容: ProxyPass /tomcat/ ajp://localhost:8009 保存后重启Apache和Tomcat服务: # /etc/init.d/httpd restart # /etc/init.d/tomcat6 restart 5、在浏览器输入http://你的IP/tomcat/,可以看到Apache SoftWare Foundation页面。 6、Tomcat Manager用户管理设置: # vim /etc/tomcat6/tomcat-users.xml 把这段配置: <tomcat-users> <!-- <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> --> <user username="admin" password="123456" roles="manager"/>#添加管理员角色manager,以及管理员账户admin和密码123456。 <!-- The host manager webapp is restricted to users with role "admin" --> <!--<user name="tomcat" password="password" roles="admin" />--> <!-- The manager webapp is restricted to users with role "manager" --> <!--<user name="tomcat" password="password" roles="manager" />--> </tomcat-users> 最后重启Tomcat服务,再进入管理页面的时候,用管理员账户admin和密码123456,登陆成功 (责任编辑:IT) |