https://yazidchen.github.io/2016/09/13/TomcatSecuritySettingOnUbuntu/
编辑/etc/rc.local找到内容为exit 0在之前添加:
/usr/local/nginx/sbin/nginx
cd /usr/lib/install/redis-2.8.3
redis-server redis.conf
在/etc/systemd/system下新建文件tomcat.service内容如下:
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/install/jdk1.7/jre
Environment=CATALINA_PID=/usr/lib/install/apache-tomcat-7.0.82/temp/tomcat.pid
Environment=CATALINA_HOME=/usr/lib/install/apache-tomcat-7.0.82
Environment=CATALINA_BASE=/usr/lib/install/apache-tomcat-7.0.82
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/usr/lib/install/apache-tomcat-7.0.82/bin/startup.sh
ExecStop=/usr/lib/install/apache-tomcat-7.0.82/bin/shutdown.sh
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target
启动tomcat:
sudo systemctl enable tomcat
sudo systemctl start tomcat