我希望将三个基于php的网络应用程序“停靠”作为代理/前端(也是docker,official container):自己的应用程序,piwik(official php-fpm docker container)和nextcloud(official php-fpm docker container )
它可以正常使用一个php-fpm容器但不能使用两个或更多(/ var / www / html至少用于两个php-fpm容器:nextcloud,piwik)。为简化起见,省略了db容器。
搬运工-compose.yml:
version: '2'
volumes:
nextcloud_data:
services:
web:
image: nginx:stable
ports:
- "80:80"
volumes:
- ./conf.d:/etc/nginx/conf.d:ro
volumes_from:
- nextcloud
- piwik # (a)
links:
- nextcloud
- piwik # (a)
restart: always
nextcloud:
image: nextcloud:11.0-fpm
volumes:
- nextcloud_data:/var/www/html
restart: always
piwik:
image: piwik:fpm
restart: always
nginx-Config conf.d/piwik.conf
- 受Indiehosters启发:
upstream php-piwik {
server piwik:9000;
}
server {
index index.php index.html;
server_name piwik.example.org;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ \.php$ {
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_intercept_errors on;
fastcgi_pass php-piwik;
}
}
nextcloud的配置类似(nextcloud.example.org)。
Piwik使用此设置正常工作(nextcloud已损坏,Web容器中的/var/www/html
包含piwik内容)。当我注释掉(a)标记的行并禁用piwik.conf时,nextcloud工作正常,但piwik已损坏(/var/www/html
包含nextcloud的东西)。我的问题是他们共享相同的路径(/var/www/html
)。我怎么能用官方图片来避免这个?