upstream hello {
server 127.0.0.1:3010;
}
server {
listen 80;
server_name clark0124.top www.clark0124.top;
rewrite ^(.*) https://$host$1 permanent;
}
server {
listen 443;
server_name clark0124.top www.clark0124.top;
ssl on;
# 证书路径不要写错
ssl_certificate /etc/nginx/cert/1535539764395.pem;
ssl_certificate_key /etc/nginx/cert/1535539764395.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
if ($ssl_protocol = "") {
rewrite ^(.*) https://$host$1 permanent;
}
location / {
proxy_set_header Host $http_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;
# 这里也要修改为你的二级域名前缀
proxy_pass http://hello;
proxy_redirect off;
}
}
本地文件上传到服务器
scd /users/edz/Desktop/111111/11111.key root@xxx.xxx.xxx:/etc/nginx/cert/xxxxx.key