phpsocketio nginx ssl 配置

server {
        listen 80;
        root /home/wei/test;
        index index.html index.htm index.php;
        server_name test.net;


        error_page 404 /index/error;

        if (!-e $request_filename){
                rewrite ^/(.*) /index.php last;
        }

        client_max_body_size  128m;
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
                fastcgi_index index.php;

                include fastcgi_params;
        }

}
server {   
        listen 443;
        server_name test.net;
        root /home/wei/test;
        index index.html index.htm index.php;
        ssl                  on;  
        ssl_certificate      cert/dev-rocket.pem;  
        ssl_certificate_key  cert/dev-rocket.key;
        ssl_session_timeout 5m;
        ssl_session_cache shared:SSL:50m;
        ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        error_page 404 /index/error;
        location /socket.io
          {    
            proxy_pass http://0.0.0.0:2120;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header X-Real-IP $remote_addr;
          }        
        if (!-e $request_filename){
                rewrite ^/(.*) /index.php last;
        }   
        client_max_body_size  128m;
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }   
    }
 
nginx  一直报错 
2019/01/23 17:53:24 [error] 57419#0: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.186.1, server: test.net, request: "GET /socket.io/?EIO=3&transport=polling&t=MXw8ElN HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php5.6-fpm.sock:", host: "test.net", referrer: "https://test.net/web-msg-sender/web/index.html"
http没问题,加了ssl就出错了
 
如果采用workman原生发现下面的错误
$context = array(
'ssl' => array(
'local_cert' => '/etc/nginx/cert/dev-rocket.pem',
'local_pk' => '/etc/nginx/cert/dev-rocket.key',
'verify_peer' => false,
'allow_self_signed' => true,
)
);
$sender_io = new SocketIO(2120,$context);

 
SSL handshake error: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate
已邀请:

six

赞同来自:

nginx配置了ssl,phpsocket.io就不用配置ssl了,都配置就冲突了

six

赞同来自:

proxy_pass http://0.0.0.0:2120;
我看到手册里这句好像不是 0.0.0.0

天的一边

赞同来自:

nginx配置找到原因了,因为
 if (!-e $request_filename){                rewrite ^/(.*) /index.php last;
        }  
这个找不到文件优先去找php了,
改成这样就好了
location / {
                  if (!-e $request_filename) {
                         rewrite ^/(.*) /index.php last;
                  }       
          }
但是现在还是没找到workman原生报的错误

天的一边

赞同来自:

现在怀疑我生成的ssl是走的TLSv1 协议,但是原生workman走的是sslv3 协议,不过个人对网络协议这一块小白一枚,不清楚怎么下一步确认问题,现在尝试生成新的ssl key

要回复问题请先登录注册