nginx配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name xxx.xxx.xxx;
rewrite ^(.*) https://$host$1 permanent;
}
# HTTPS server
server {
listen 443 ssl;
server_name xxx.xxx.xxx;
ssl_certificate /usr/local/nginx/cert.pem;
ssl_certificate_key /usr/local/nginx/key.pem;
ssl_session_timeout 5m;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Cookie $http_cookie;
proxy_connect_timeout 30;
proxy_set_header Referer $http_referer;
}
}
}
tomcat 配置无需更改