简单的nginx配置
upstream pj_host {
server 119.75.216.20:80 weight=5; #百度ip加端口,weight=x 是代表权重5:2的频率分发
server 127.0.0.1:3006; #自己网站
}
server {
端口
charset utf-8;
listen 443;
client_max_body_size 128M;
listen 9999;
绑定的网站
#server_name www.html7.top;
server_name www.santant.top;
项目的目录
ssl on;
root /data/dist/;
ssl_certificate /data/www/cert/cert-1523944861629_www.santant.top.crt;
ssl_certificate_key /data/www/cert/cert-1523944861629_www.santant.top.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
proxy_pass http://pj_host;
}
}
server {
listen 80;
server_name www.santant.top; #你的域名
rewrite ^(.*)host$1 permanent; #把http的域名请求转成https
}