server {
listen 80;
server_name mydomain;
return 301
https://mydomain; 或者 return 301
https://$server_name$request_uri; }
server{
listen 443;
server_name mydomain;
ssl on;
ssl_certificate /etc/nginx/conf.d/mydomain.crt;
ssl_certificate_key /etc/nginx/conf.d/mydomain.key;
error_page 497
https://$host:443; proxy_redirect http:// $scheme://;
port_in_redirect on;
access_log /var/log/nginx/access.log main;
location ~/druid{
return 404;
}
location /nginx-status {
stub_status on;
access_log off;
}
location /{
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
expires 10d;
proxy_pass
http://mydomain ;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
client_max_body_size 10m;
client_body_buffer_size 256k;
}
}