f1ynnv2
V2EX  ›  Docker

使用 docker 搭建 PHP 应用时 web server 的选择

  •  
  •   f1ynnv2 · Jan 23, 2023 · 1606 views
    This topic created in 1212 days ago, the information mentioned may be changed or developed.

    php 的应用是 dokuwiki 。

    我目前的方案是 nginx + php-fpm 来运行 dokuwiki 。其中 nginx 即作为 webserver,又配合 acme.sh 提供 https 服务。

    现在准备把这套东西 docker 化,方便后面折腾(细节不表)

    找了一下 Nginx Proxy Manager 这个是基于 docker 的反代方案,也能提供 SSL 证书免费更新,正好可以给手头的其它服务一起提供 https 服务,就准备用它了。

    然后再准备拉一个 php-fpm 的镜像来提供指定版本的 php 也没问题。

    现在就是关于 webserver ,虽然前面 Nginx Proxy Manager 里面其实已经跑了个 Nginx 了,但是它这个 Nginx 应该是不能对外提供 Web server 功能吧。

    我的疑问是,我是不是还得专门再搞个 nginx 的镜像专门用来为 dokuwiki 提供 webserver 的功能?总感觉怪怪的,这样就跑了 2 个 Nginx 了。 或者是否有其它轻量级的 webserver ?像是 sprintboot 里那种 Netty 轻量级的 http server?

    或者我是不是对 docker 的使用有些误解,像是这种情况就直接专门搞个 nginx 镜像作为 webserver 得了,不用管其它镜像里是不是也有 nginx 。

    2 replies    2023-01-25 11:34:46 +08:00
    superares
        1
    superares  
       Jan 24, 2023 via iPhone
    负载小用 apache+mod_php 的镜像就行了。
    baobao1270
        2
    baobao1270  
       Jan 25, 2023
    我是选择基于 alpine 把 nginx+php 打包在一个 image 里,名字就叫 lnmp ,然后再基于这个镜像构建 PHP 应用的镜像。没有用官方的 nginx 和 php-fpm 镜像。
    至于 acme ,还是建议你使用 dns mode ,跑在宿主机上,然后把 https 证书挂在到 traefik 。
    因为我一个服务器上会运行多个应用,有不同的 host ,所以用 traefik 作 HTTP 路由。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:12 · PVG 03:12 · LAX 12:12 · JFK 15:12
    ♥ Do have faith in what you're doing.