嗨,大家好,我想在Apache上安装2个虚拟主机:一个指向www.mysite.com(php-fpm容器),另一个指向www.mysite.com/blog (wordpress fpm容器)。
我使用Docker和compose,实际的文件是这样的
server:
build: ./docker/apache
image: server:latest
links:
- fpm
ports:
- 80:80
- 443:443
volumes:
- webroot:/var/www/html/mysite.com
fpm:
build: ./docker/php
image: fpm:latest
links:
- database
volumes:
- webroot:/var/www/html/mysite.com
database:
build: ./docker/mariadb
image: database:latest
env_file:
- ./docker/mariadb/env
volumes:
- dbdata:/var/lib/mysql
wpdatabase:
image: mysql:latest
volumes:
- wpdbdata:/var/lib/mysql
blog:
image: wordpress:4.9.1-php7.1-fpm-alpine
links:
- wpdatabase
我到目前为止所做的是添加从博客服务到服务器的链接,并像这样更改了vhost文件
## New host
<VirtualHost *:80>
ServerName www.mysite.com:80
ServerAlias mysite.com:80
ServerPath /blog/
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html/"
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://blog:9000/var/www/html/$1 timeout=120
DirectoryIndex index.php
ErrorLog /usr/local/apache2/logs/blog.log
</VirtualHost>
##
<VirtualHost *:80>
ServerName www.mysite.com:80
ServerAlias mysite.com:80
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mysite.com
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://fpm:9000/var/www/html/mysite.com/$1 timeout=120
DirectoryIndex index.php
ErrorLog /usr/local/apache2/logs/error.log
</VirtualHost>
...但我不断获得Not Found
救救我!感谢