配置¶
nginx常用配置,对应位置修改即可
server {
listen 443 ssl;
server_name highvenue.cn www.highvenue.cn;
ssl_certificate /etc/nginx/cert/3407852_www.highvenue.cn.pem;
ssl_certificate_key /etc/nginx/cert/3407852_www.highvenue.cn.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 /api/ {
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_redirect off;
proxy_pass http://127.0.0.1:5000/api/;
}
location /static/ {
alias /root/HighVenueCloud/static/;
}
location /qr/ {
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_redirect off;
proxy_pass http://127.0.0.1:5001/qr/;
}
location /biological/ {
alias /root/biological/;
try_files $uri $uri/ =404;
}
}
server {
listen 80;
server_name highvenue.cn www.highvenue.cn; #将localhost修改为您证书绑定的域名,例如:www.example.com。
rewrite ^(.*)$ https://$host$1 permanent; #将所有http请求通过rewrite重定向到https。
location / {
index index.html index.htm;
}
}