简体   繁体   中英

Laravel-echo-server failed to start in production with https protocol

I have hosted my project in digitalocean. I am using laravel echo server and it was working fine with http but when i have set up letsencrypt, laravel echo server failed to start.

Here is laravel echo server configuration.

{   
    "authHost": "https://example.com/api/",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
            {
                "appId": "86f96c2b2ca85e8a",
                "key": "0e917607d0910b9e2670d281a0e2b254"
            }
    ],
    "database": "redis",
    "databaseConfig": 
    {
        "redis": {},
        "sqlite": 
        {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": true,
    "host": null,
    "port": "6001",
    "protocol": "https",
    "socketio": {},
    "sslCertPath": "/etc/letsencrypt/csr/0000_csr-certbot.pem",
    "sslKeyPath": "/etc/letsencrypt/keys/0000_key-certbot.pem",
    "sslCertChainPath": "",
    "sslPassphrase": "",
    "subscribers": 
    {
        "http": true,
        "redis": true
    },
    "apiOriginAllow": 
    {
        "allowCors": true,
        "allowOrigin": "http://localhost:80",
        "allowMethods": "GET, POST",
        "allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
    }
}

I expect laravel echo server to start and listen for events but fails to start and showing this error.

L A R A V E L  E C H O  S E R V E R

version 1.5.0

⚠ Starting server in DEV mode...

(node:22827) UnhandledPromiseRejectionWarning: Error: error:0909006C:PEM routines:get_name:no start line
    at Object.createSecureContext (_tls_common.js:136:17)
    at Server (_tls_wrap.js:870:27)
    at new Server (https.js:62:14)
    at Object.createServer (https.js:85:10)
    at Server.httpServer (/usr/local/lib/node_modules/laravel-echo-server/dist/server.js:60:36)
    at /usr/local/lib/node_modules/laravel-echo-server/dist/server.js:34:35
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:22827) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22827) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I had exactly the same issue trying to run the Laravel Echo Server in production.

Try making the following changes to the laravel-echo-server.json file:

"sslCertPath": "/etc/nginx/ssl/YOURPROJECT/601901/server.crt",
"sslKeyPath": "/etc/nginx/ssl/YOURPROJECT/601901/server.key",

Update the YOURPROJECT with your domain. If you are using Laravel Forge this should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM