Do we need to serve Octane (FrankenPHP) via Nginx? #49495
-
Hi artisans, I have a question about serving Octane (especially w/ FrankenPHP) via Nginx. As documented, I believe it's recommended to run Octane via Nginx. However, I saw some articles say FrankenPHP doesnt require nginx anymore. So, my question is, if we run Octane w/ FrankenPHP, are we supposed to remove nginx or its still best practice to serve Octane via nginx even we use FrankenPHP? Thanks for your help in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Absolutely not. You can run the Octane application without Nginx. FrankenPHP is not required either. You can do that with Roadrunner or Swoole. Just bind the process on port 80 and (for example) configure the Cloudflare proxy to handle the frontend. php artisan octane:start --host=0.0.0.0 --port=80 Note: you'll probably need to send headers manually from your application. Route::get('/', fn () => view('welcome'))
->name('home')
->middleware('cache.headers:public;max_age=31536000'); |
Beta Was this translation helpful? Give feedback.
Absolutely not.
You can run the Octane application without Nginx. FrankenPHP is not required either. You can do that with Roadrunner or Swoole. Just bind the process on port 80 and (for example) configure the Cloudflare proxy to handle the frontend.
Note: you'll probably need to send headers manually from your application.
For that purpose, you can use Laravel's built-in middleware. For example: