Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I configure Octane for HTTPS
    Laravel Octane HTTPS SSL/TLS configuration web server setup Nginx Apache Laravel security


How do I configure Octane for HTTPS


Here is how to configure Laravel Octane to serve your application over HTTPS:

1. Install the required SSL/TLS certificates for your domain. You can use a service like Let's Encrypt to obtain free SSL/TLS certificates.[4][5]

2. In your Octane configuration file (`config/octane.php`), set the `'ssl'` option to `true` and provide the paths to your SSL/TLS certificate files:

php
'swoole' => [
    'ssl' => true,
    'options' => [
        'ssl_cert_file' => '/path/to/your/ssl/certificate.crt',
        'ssl_key_file' => '/path/to/your/ssl/private.key',
    ],
],

3. Configure your web server (e.g. Nginx or Apache) to proxy requests to the Octane server running on port 8000 and handle the SSL/TLS termination. Here's an example Nginx configuration:

nginx
server {
    listen 80;
    listen 443 ssl;
    server_name your-domain.com;

    ssl_certificate /path/to/your/ssl/certificate.crt;
    ssl_certificate_key /path/to/your/ssl/private.key;

    location / {
        proxy_pass https://127.0.0.100;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

4. Start the Octane server using the `octane:start` Artisan command:


php artisan octane:start

By following these steps, you can configure Laravel Octane to serve your application over a secure HTTPS connection. The web server will handle the SSL/TLS termination, and Octane will handle the application logic.

Citations:
[1] https://community.microfocus.com/devops-cloud/alm-octane/f/discussions/511450/how-to-configure-ssl-certificate-on-alm-octane
[2] https://help.sap.com/doc/9a579745e8b745f78cc2a378f5d1f40c/15.00/en-US/Octane_Installation_Guide%20for%20Linux.pdf
[3] https://frankenphp.dev/docs/laravel/
[4] https://github.com/laravel/framework/discussions/51069
[5] https://stackoverflow.com/questions/78328702/laravel-octane-with-swoole-https-configuration-apache-vhost-proxy-error