文章列表
前言: 需要先申请ssl证书,并将域名解析到到当前服务器的ip,同时当前服务器需要开通入方向的443端口 配置 # HTTPS server server { listen 443 ssl; server_name test.com; #证书地址 ssl_certificate /usr/local/nginx/conf/ssl/test.cer; ssl_certificate_key /usr/local/nginx/conf/ssl/test.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5;
199次 Nginx
nginx中配置websocket location /websocket { proxy_set_header Host $host:8000; proxy_pass http://ip:port/websocket;#通过配置端口指向部署websocket的项目 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; }
192次 Nginx
在现在的开发中我们经常会遇到前后端请求跨域问题,我们常用Nginx软件来解决这类问题,因此要在Nginx配置api接口端口映射,否则接口便因为跨域问题无法访问. 跨域配置: location /api { proxy_set_header Host $host:8000; 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://ip:port/api; client_max_body_size 1000m; }
157次 Nginx
nginx中部署vue: location /vue { proxy_set_header Host 8000; 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; try_files $uri $uri/ /vue/index.html; alias D://nginx-1.18.0//html//vue//; #index index.html index.htm; }
151次 Nginx
微信
返回顶部