mark icon indicating copy to clipboard operation
mark copied to clipboard

how can enable ssl ?

Open javadrajabi opened this issue 4 years ago • 5 comments
trafficstars

How is ssl enabled in this framework?

javadrajabi avatar Apr 13 '21 10:04 javadrajabi

i too may require SSL in my project. Since this is based on workerman, i'm looking at this link from workerman github page. Will try and provide more feedback on this. Maybe some SSL code sample in documentation is needed.

iprastha avatar Apr 22 '21 04:04 iprastha

i too may require SSL in my project. Since this is based on workerman, i'm looking at this link from workerman github page. Will try and provide more feedback on this. Maybe some SSL code sample in documentation is needed.

I ended up using nginx with reverse proxy to localhost mark workers, reason being:

  1. using certbot to automatically renew my SSL certificate with automatic configuration for nginx
  2. faster worker because no ssl configuration is required in mark project

so my workers are running at http://localhost:3000 and my nginx is set up at mydomain.com:443 (with SSL) , using reverse_proxy pass to http://localhost:3000 Something like this in my nginx config:

server{
listen 443 ssl;
... other SSL configs set by certbot ...
location / {
        proxy_pass http://127.0.0.1:3000;
    }
}

iprastha avatar May 07 '21 14:05 iprastha

Please correct me if I'am wrong but, mark is based on workerman and workerman supports SSL

--- start.php	2021-08-24 12:20:47.752143969 +0200
+++ start-ssl.php	2021-08-24 15:04:36.983849892 +0200
@@ -3,7 +3,19 @@
 
 require 'vendor/autoload.php';
 
-$api = new App('http://0.0.0.0:3000');
+// SSL context.
+$context = array(
+    'ssl' => array(
+        'local_cert'  => '/path/to/server.crt',
+        'local_pk'    => '/path/to/server.key',
+        'verify_peer' => false,
+    )
+);
+
+
+$api = new App('http://0.0.0.0:3000', $context);
+
+$api->transport = 'ssl';

xenogenesi avatar Aug 24 '21 13:08 xenogenesi