环境:centos 6.9 64位系统+tomcat7
step1 下载:apache-tomcat-7.0.78.tar.gz
step2 解压缩:tar -zxvf apache-tomcat-7.0.78.tar.gz
step3 修改配置
a.vim /etc/sysconfig/iptables
开放8080端口加入以下一行配置
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
重启防火墙:service iptables restart
b.修改tomcat server.xml文件 编码改为utf-8,因为服务器端保险起见设置为utf-8,这样才能减少乱码的可能性
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>
c.修改tomcat-user.xml
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles=" admin-gui , manager-gui "/>
启动tomcat
linux环境:127.0.0.1:8080访问
windows:linux_ip:8080
两者都ok证明配置ok