zoukankan      html  css  js  c++  java
  • nginx配置wss

    upstream websocket {
    server 127.0.0.1:9501;#wss配置代理到ws:127.0.0.1:9501
    }
    server {
    listen 80;
    listen 443 ssl;
    server_name api.meigou.local.com;
    
    ####ssl须使用openssl生成 ssl_certificate
    /Users/apple/ssl/aliyun_server.pem; ssl_certificate /Users/apple/ssl/server.crt; ssl_certificate_key /Users/apple/ssl/aliyun_server.key; ssl_certificate_key /Users/apple/ssl/server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on;
    #######openssl生成
    #rewrite ^(.*)$ https://$host$1 permanent; #charset koi8-r; if ($time_iso8601 ~ "^(d{4})-(d{2})-(d{2})") { set $year $1; set $month $2; set $day $3; } access_log logs/api.meigou.local.com.access-$year-$month-$day.log.log main; index index.html index.htm index.php;
    ##访问域名wss://api.meigou.local.com/wss 即可 location
    /wss {   proxy_pass http://websocket;##代理到上面的ip   proxy_http_version 1.1;   proxy_set_header Upgrade $http_upgrade;   proxy_set_header Connection "Upgrade"; } location / { root /Users/apple/Documents/workspace/meigou_api/public; # index index.html index.htm index.php; try_files $uri $uri/ /index.php?$query_string; client_max_body_size 50m; limit_req zone=one burst=5 nodelay; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root /Users/apple/Documents/workspace/meigou_api/public; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; client_max_body_size 50M; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} }
  • 相关阅读:
    Java自学二十六天
    Java自学三十四天
    Java自学三十二天
    Java自学三十天
    Java开学考试心得
    Java自学二十九天
    Java自学二十八天
    Java自学三十一天
    Java自学三十三天
    2020年月12日Java学习日记
  • 原文地址:https://www.cnblogs.com/guokefa/p/11776493.html
Copyright © 2011-2022 走看看