NGINX和JAVA示例
upstream miao_server {
#server 192.168.209.53:8080 max_fails=2 fail_timeout=10s;
#server 192.168.209.54:8080 max_fails=2 fail_timeout=10s;
server 192.168.104.233:8080 max_fails=2 fail_timeout=10s;
}
server {
listen 80;
server_name gjmiao.swjoy.com;
charset utf-8;
if ($host = 'gjmiao.swjoy.com' ) {
rewrite ^(.*) https://$host$1 permanent;
}
}
server {
listen 443 ssl;
server_name gjmiao.swjoy.com;
ssl_certificate /usr/local/nginx/conf/conf.d/swjoy.com.pem;
ssl_certificate_key /usr/local/nginx/conf/conf.d/swjoy.com.key;
client_max_body_size 100m;
root /data/www/ROOT/static/miao/cdn/;
location ~ /(front|back)/ {
proxy_pass http://miao_server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/([a-z0-9_]+)\.html$ {
rewrite "^/([a-z0-9_]+)\.html" "/lm/$1.html" break;
}
location = / {
index lm/index.html;
}
}
server {
listen 80;
server_name resgjmiao.swjoy.com;
charset utf-8;
if ($host = 'resgjmiao.swjoy.com' ) {
rewrite ^(.*) https://$host$1 permanent;
}
location / {
index index.html index.htm;
}
}
server {
listen 443 ssl;
server_name resgjmiao.swjoy.com;
charset utf-8;
ssl_certificate /usr/local/nginx/conf/conf.d/swjoy.com.pem;
ssl_certificate_key /usr/local/nginx/conf/conf.d/swjoy.com.key;
client_max_body_size 100m;
root /data/www/ROOT/static/miao/cdn/;
location ~ \.(eot|woff|ttf|otf|woff2)$ {
#add_header Access-Control-Allow-Origin https://gjmiao.swjoy.com;
add_header Access-Control-Allow-Origin *;
index index.html index.htm;
}
location / {
index index.html index.htm;
}
}
[program:lanmiao]
command=java -jar -Dserver.port=8080 -Dlog.path=/data/www/ROOT/lanmiao/logs -Xrunjdwp:transport=dt_socket,address=8897,server=y,suspend=n /data/www/ROOT/lanmiao/lm-web.jar --spring.config.location=file:/data/www/ROOT/lanmiao/bootstrap.properties
directory=/data/www/ROOT/lanmiao
autostart=true
autorestart=true
startsecs=3
stopsignal=INT
stdout_logfile=/dev/null
stderr_logfile=/dev/null