tomcat部署

1 server.xml

<Service name="www.baidu.com"> 
  <Connector port="9801" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>  
  <Engine name="www.baidu.com" defaultHost="127.0.0.1"> 
    <Host name="127.0.0.1" appBase="/opt/lampp/java_application/apache-tomcat-8.5.20/webapps" unpackWARs="false" autoDeploy="true"> 
      <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/opt/lampp/java_application/apache-tomcat-8.5.20/websites/www.baidu.com/catalina-logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>  
      <Context path="/" docBase="/opt/lampp/java_application/apache-tomcat-8.5.20/websites/www.baidu.com/webroot"/> 
    </Host> 
  </Engine> 
</Service>

2 打开web.xml,将<param-name>listings</param-name> 改成<param-name>false</param-name>

3 conf/tomcat-user.xml中的所有用户的注释掉

4 检查JDK版本是否一致,不一致则升级jdk。然后更改为普通权限用户自启动

改为普通用户
将apache-tomcat-8.5.20及其子目录文件所有者都改为tomcat,然后运行:
su tomcat -c /opt/lampp/java_application/apache-tomcat-8.5.20/bin/startup.sh

设置自启动:
export JAVA_HOME=/usr/java/jdk1.8.0_144
su tomcat -c /opt/apache-tomcat-8.5.20/bin/startup.sh
5 如果mysql是用的XAMPP集成的,则需要开启mysql的守护端口(默认是不开端口的)
注释掉my.cnf中的skip-networking (注意,注释后,不能直接调用lampp reloadmysql,是无法生效的,要先stop再启动)

发表评论