【下图演示】
开发商您好!最近我试图对一个 php 网站进行 dockerize,但是当我尝试从一个网站卷曲到另一个网站时,连接被拒绝。
基本上我有三个网站:
应用程序编程接口
第一站点
第二站点
问题是connection is refused when I try to call api from first-site.
./docker-compose.yml
version: "3.1"
services:
www:
build: ./www/.
ports:
- "0.0.0.0:8080:80"
- "0.0.0.0:443:443"
volumes:
- ./htdocs:/var/www
- ./www/conf:/etc/httpd/conf
networks:
- local
php:
build: ./php/.
ports:
- '9000'
volumes:
- ./htdocs:/var/www
networks:
- local
networks:
local:
driver: bridge
./www/Dockerfile
FROM centos:8.2.2004
MAINTAINER kenphanith <https://github.com/kenphanith>
LABEL description="develop environment"
LABEL httpd_version="2.4"
RUN dnf -yq module install httpd:2.4 && \
dnf -yq install epel-release && \
dnf -yq install mod_perl ImageMagick && \
dnf clean all
RUN sscg -q \
--cert-file /etc/pki/tls/certs/localhost.crt \
--cert-key-file /etc/pki/tls/private/localhost.key \
--ca-file /etc/pki/tls/certs/localhost.crt \
--lifetime 365 \
--hostname localhost \
--email root@localhost
EXPOSE 80/tcp 443/tcp
WORKDIR /var/www
CMD ["/usr/sbin/apachectl","-D","FOREGROUND"]
我里面./www/conf
有
/vhost.d
/ssl
第一站点配置文件
第二个站点.conf
接口配置文件
httpd.conf
第一站点配置文件
<VirtualHost *:80>
ServerName firstsite.com
DocumentRoot /var/www/firstsite
<Directory "/var/www/firstsite">
Options -Indexes +FollowSymLinks
DirectoryIndex index.php index.html
<FilesMatch \.php$>
SetHandler "proxy:fcgi://php:9000"
</FilesMatch>
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName firstsite
DocumentRoot /var/www/firstsite
</VirtualHost>
手掌心