97 lines
2.7 KiB
Plaintext
97 lines
2.7 KiB
Plaintext
|
worker_processes 1;
|
|||
|
|
|||
|
events {
|
|||
|
worker_connections 1024;
|
|||
|
}
|
|||
|
|
|||
|
http {
|
|||
|
include mime.types;
|
|||
|
default_type application/octet-stream;
|
|||
|
sendfile on;
|
|||
|
keepalive_timeout 65;
|
|||
|
|
|||
|
gzip on;
|
|||
|
gzip_min_length 1k;
|
|||
|
gzip_buffers 16 64K;
|
|||
|
gzip_http_version 1.1;
|
|||
|
gzip_comp_level 5;
|
|||
|
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
|
|||
|
gzip_vary on;
|
|||
|
gzip_proxied expired no-cache no-store private auth;
|
|||
|
gzip_disable "MSIE [1-6]\.";
|
|||
|
|
|||
|
server {
|
|||
|
listen 80;
|
|||
|
server_name localhost;
|
|||
|
location / {
|
|||
|
rewrite ^(.*) https://$server_name$1 permanent;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
server {
|
|||
|
# 侦听443端口
|
|||
|
listen 443 ssl;
|
|||
|
# 定义访问域名
|
|||
|
server_name localhost;
|
|||
|
#证书文件名称
|
|||
|
ssl_certificate domain_bundle.crt;
|
|||
|
#私钥文件名称
|
|||
|
ssl_certificate_key domain.key;
|
|||
|
|
|||
|
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
|
|||
|
#error_page 404/404.html;
|
|||
|
#HTTP_TO_HTTPS_START
|
|||
|
if ($server_port !~ 443){
|
|||
|
rewrite ^(/.*)$ https://$host$1 permanent;
|
|||
|
}
|
|||
|
ssl_session_timeout 10m;
|
|||
|
#请按照以下协议配置
|
|||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|||
|
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
|
|||
|
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
|
|||
|
ssl_prefer_server_ciphers on;
|
|||
|
|
|||
|
# web端
|
|||
|
location / {
|
|||
|
root /var/wumei-smart/vue;
|
|||
|
try_files $uri $uri/ /index.html;
|
|||
|
index index.html index.htm;
|
|||
|
}
|
|||
|
|
|||
|
# 服务端接口
|
|||
|
location /prod-api/{
|
|||
|
proxy_set_header Host $http_host;
|
|||
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
proxy_set_header REMOTE-HOST $remote_addr;
|
|||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
proxy_pass http://localhost:8080/;
|
|||
|
}
|
|||
|
|
|||
|
# emqx接口
|
|||
|
location /api/v4/{
|
|||
|
proxy_set_header Host $http_host;
|
|||
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
proxy_set_header REMOTE-HOST $remote_addr;
|
|||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
proxy_pass http://localhost:8081/api/v4/;
|
|||
|
}
|
|||
|
|
|||
|
# wss连接
|
|||
|
location /mqtt {
|
|||
|
proxy_pass http://localhost:8083/mqtt;
|
|||
|
proxy_read_timeout 90s;
|
|||
|
proxy_set_header Host $host;
|
|||
|
proxy_set_header X-Real_IP $remote_addr;
|
|||
|
proxy_set_header X-Forwarded-for $remote_addr;
|
|||
|
proxy_http_version 1.1;
|
|||
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
proxy_set_header Connection 'Upgrade';
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
error_page 500 502 503 504 /50x.html;
|
|||
|
location = /50x.html {
|
|||
|
root html;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|