Nginx Unit changes how we host PHP (& Laravel)

Поділитися
Вставка

КОМЕНТАРІ • 32

  • @vaviloffx
    @vaviloffx 11 місяців тому +5

    Nice experiment! And thanks for listing the cons - the lack of Gzip compressions, inability to protect dot files and set cache headers for static files. We'll stick with good ol' nginx+PHP-FPM for now :D

    • @fideloper
      @fideloper  11 місяців тому +2

      Yeah, altho I think you can configure a lot of that (except for gzip). A lot of times I think you'd use this in like a container or something have an http layer on top of it that can handle gzip, etc.

  • @locusm
    @locusm Рік тому

    From HN to video in under 24 hrs!
    Having a play with this today so your timing is perfect.

  • @Loige
    @Loige 11 місяців тому

    This looks super convenient. I didn't came across it before, thanks a million for sharing it!

  • @ryanvelbon
    @ryanvelbon 3 місяці тому

    Great content. Keep 'em coming please!

  • @uxweb
    @uxweb 11 місяців тому +1

    Wow! This looks so promising for PHP. It appears to have more steps involved for installing. What do you think it would be more simple? To install unit from a PHP base docker image or to install PHP from a unit base image? Thank you!

  • @DaviMartins99
    @DaviMartins99 9 місяців тому

    Incredible content, Chris
    Thank you!

    • @fideloper
      @fideloper  9 місяців тому

      Thanks for saying so, glad it's helpful!

  • @packofblackdogs
    @packofblackdogs 11 місяців тому

    Unit is awesome, but I had slightly different approach: install containerized unit-php8.2 and then run laravel. Very neat result. Until I had to make some mysql queries and not sqlite3. But that's fixable too.

    • @fideloper
      @fideloper  11 місяців тому

      Yeah for sure - definitely a valid way to go.
      I think their official images come out pretty large, I'm in process of playing with containerizing it myself. Got to around 285mb of image size with a base of ubuntu:22.04 (multi-stage build to compile the PHP module separately)

  • @fevangelou
    @fevangelou 10 місяців тому

    Might be interesting to benchmark Unit with a multi port config (attached to the same backend) & load balanced by some Nginx proxy config VS Unit with a processes config for a single port. All in all its definitely more flexible compared to FPM. And with some smart Nginx proxying, any non-PHP requests could be entirely offloaded to Nginx. That being said, if Unit's config also allowed defining the path to the unit-php binary, that would probably make a multi-PHP setup easier.

    • @fideloper
      @fideloper  10 місяців тому +1

      Yeah! I think the key with the multiple PHP versions is naming the PHP modules something different on each build/compilation. I haven't tested that yet, however.

  • @tofiqhamza9102
    @tofiqhamza9102 Рік тому +1

    Very cool.

  • @cooltech5441
    @cooltech5441 4 місяці тому

    I already have nginx server on my ubuntu 22.04 running for several project, I want to try nginx unit for my newest project, if I install this nginx unit, would it break my nginx and all related website?

    • @fideloper
      @fideloper  3 місяці тому

      i don’t think so - but i’d experiment in a docker container first.

  • @tom96508
    @tom96508 11 місяців тому

    I really appreciate this video, you are very good at explaining, I love that you go line by line. The only problem I have is with static files, for example a .txt file inside /public or the sitemap itself (.xml), do you have any idea how to handle this to make it work?

    • @fideloper
      @fideloper  11 місяців тому

      In my experience (just tested this!) these static files just work - nginx unit is smart enough to set the correct content-type headers (I tested .css, .js. .txt. .xml).It did NOT, however, protect against dot files (likely would with further config)

  • @irawan953
    @irawan953 Рік тому

    Cool , Thanks

  • @thecaribcoder
    @thecaribcoder 9 місяців тому

    Been battling with this for hours now. For some reason keep getting the following error when I try to push the config
    ```
    {
    "error": "Invalid configuration.",
    "detail": "The module to run \"php\" is not found among the available application modules."
    }
    ```
    Any ideas?

    • @fideloper
      @fideloper  9 місяців тому

      that’s happened to me when they released a new version and the php module i built didn’t match versions.
      Make sure the version you download to build the php module is the latest version.

    • @thecaribcoder
      @thecaribcoder 9 місяців тому

      @@fideloper was trying to build using a base Ubuntu image but just ended up using the provided unit php docker image in the end after 5 hours of frustration lol. Maybe I'll revisit in the future but their provided image works for right now

  • @vchopanov
    @vchopanov 11 місяців тому

    how to get metrics?

  • @hristijant9578
    @hristijant9578 11 місяців тому

    Great content! Would love to hear your opinion on Laravel Octane with different application servers as well.

  • @devbugado
    @devbugado 11 місяців тому

    Fancy to try frankenphp?

    • @fideloper
      @fideloper  11 місяців тому +1

      I haven’t tried it other than casually loading up their docker image. What I like about Unit is that I don’t need to compile PHP and do any non-standard installation/run time of PHP.

  • @gocanto
    @gocanto Рік тому +1

    or, we use GO :)

    • @gocanto
      @gocanto Рік тому

      awesome content Nonetheles... Thanks

  • @gadelat2
    @gadelat2 11 місяців тому

    According my tests unit-php can't handle concurrencty when script is doing sleep()

    • @fideloper
      @fideloper  11 місяців тому

      oh that's interesting! If some PHP sleep()'s in middle of handling a web request, what behavior do you see? Every other request fails?

    • @gadelat2
      @gadelat2 11 місяців тому +1

      @@fideloper no but they are queued up, unit seem to process only sleep in one process at the time