Linux
pkill -f xxxx.jar -e
#添加空间,1024块1M的空间
dd if=/dev/zero of=/home/swapfile bs=1M count=1024
#设置交换分区文件
mkswap /home/swapfile
#启用交换分区文件
swapon /home/swapfile
使系统开机时自启用,在文件/etc/fstab中添加一行
/home/swapfile swap swap defaults 0 0
sudo -s
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update
apt-get install nginx
<Service name="app">
<Connector port="9090" protocol="HTTP/1.1" URIEncoding="UTF-8"
connectionTimeout="20000" redirectPort="8443" />
<Engine name="app" defaultHost="localhost">
<Host name="localhost" appBase="app"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs/app"
prefix="app_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
<!--
此处的`app`是与`webapp`同级的,需要注意权限问题。
chmod -R tomcat7:tomcat7 app/
-->
#!/bin/bash
#
# /etc/init.d/tomcat
#
# This is the init script for starting up the
# Jakarta Tomcat server
#
# chkconfig:345 91 10
# description: Starts and stops the Tomcat daemon.
#
tomcat=/usr/application/apache-tomcat
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
start() {
echo -n $"Starting Tomcat service: "
sh $startup
echo $?
}
stop() {
echo -n $"Stopping Tomcat service: "
sh $shutdown
echo $?
}
restart() {
stop
start
}
status() {
ps -aef | grep apache-tomcat | grep -v tomcat8 | grep -v grep
}
# Handle the different input options
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
ssserver -p 443 -k whatisit! -m aes-256-cfb --user nobody -d start
Original Message
If you really want to use OpenJDK, you have to compile from source. There is not still any PPA for OpenJDK.
It has been requested at https://bugs.launchpad.net/ubuntu/+bug/1297065
I recommend you to use Webup8 Oracle Java8 Installer
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
To automatically set up the Java 8 environment variables
sudo apt-get install oracle-java8-set-default
Check it
java -version
So you have to wait to use OpenJDK8
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
# Om nom nom cookies
#
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
--------------------------------
上面的解决方案只会对 200,204,301,302生效,也就是说对4XX和5XX的status code并不会生效,需要使用 headers_more模块
https://www.nginx.com/resources/wiki/modules/headers_more/
Linux命令或者配置