RockyLinux 8 || HTTPD (Apache 2.4) || PHP-FPM 7.2, 7.3 (from remi-repo)
1.1K
If you want to use more modern PHP (7.4, 8.0, 8.1, 8.2, 8.3) fallow link. https://hub.docker.com/r/san0123/rocky9-http-php
C:\> docker run -d -p 80:80 -e TZ=Asia/Seoul --mount type=bind,source=d:\project\abc.com\html,target=/var/www/html san0123/rocky8-http-php:7.3
~]$ sudo groupadd -g 48 apache
~]$ sudo useradd -s /sbin/nologin -u 48 -g apache -d /usr/share/httpd -c Apache apache
~]$ sudo chown apache: /free/home/project/html
~]$ sudo docker run --detach --restart unless-stopped \
--name project --publish 80:80 \
--env TZ=Asia/Seoul \
--mount type=bind,source=/free/home/project/html,target=/var/www/html \
san0123/rocky8-http-php:7.3
~]$ sudo docker exec -it project bash -l
~]$ sudo docker logs -f main_site
| option | value | Describe |
|---|---|---|
--name | project | Set to Container name |
--restart | unless-stopped | Container is not recently stopped, it'll be start |
--publish | 80:80 | docker_proxy Host:80 to Container:80 |
--env | TZ=Asia/Seoul | Set Container Timezone to Asia/Seoul |
| option | value | HOST OS | HOST volume | Container volume |
|---|---|---|---|---|
--mount | type=bind,source=/free/home/project/html,target=/var/www/html | Linux | /free/home/project/html | /var/www/html |
--mount | type=bind,source=d:\project\abc.com\html,target=/var/www/html | Windows | D:\project\abc.com\html | /var/www/html |
Apache and PHP-FPM connecting FastCGI with PORT(:9000). coz some PC or Server are cannot run PHP-FPM with unix socket file.
/etc/php.ini was edited some like below.short_open_tag = On
upload_max_filesize = 100M
post_max_size = 120M
mysqli.allow_local_infile = On
/etc/httpd/conf/httpd.conf file contains the trusted private IPs. and .htaccess file allowed in httpd.conf file.<Files ".ht*">
Require all granted
</Files>
...
...
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.0.0.0/8
RemoteIPTrustedProxy 172.16.0.0/12
RemoteIPTrustedProxy 192.168.0.0/16
/etc/httpd/conf.d/userdir.conf<DirectoryMatch ".*\.(git|svn)/.*">
Require all denied
</DirectoryMatch>
<FilesMatch "\.(inc|ini|conf|cfg|properties)$">
Require all denied
</FilesMatch>
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Require all denied
</Files>
~]$ sudo docker exec project composer create-project codeigniter4/appstarter html
~]$ sudo docker exec project chown -R apache: html
~]$ sudo docker exec project sed -i "s+DocumentRoot \"/var/www/html+DocumentRoot \"/var/www/html/public+g" /etc/httpd/conf/httpd.conf
~]$ sudo docker restart project
Content type
Image
Digest
sha256:9e698491b…
Size
180.8 MB
Last updated
about 1 year ago
docker pull san0123/rocky8-http-php:7.3