docker工人:Dockerising多个WordPress站点

我试图按照这里的例子: https : //www.howtoforge.com/tutorial/dockerizing-wordpress-with-nginx-and-php-fpm/#step-accessing-the-docker-container

一切正常,只为一个WP实例。 但是一旦我试图添加另一个,通过执行以下操作:

wordpress: image: wordpress:4.7.1-php7.0-fpm links: - mysql expose: - '9000' volumes: - ./wordpress:/var/www/html environment: - VIRTUAL_HOST=oleg.local - WORDPRESS_DB_NAME=wpdb - WORDPRESS_TABLE_PREFIX=wp_ - WORDPRESS_DB_HOST=mysql - WORDPRESS_DB_PORT=3312 - WORDPRESS_DB_PASSWORD=example olegs: image: wordpress:4.7.1-php7.0-fpm links: - mysql expose: - '9000' # ports: # - '9001:9000' volumes: - ./olegs:/var/www/html environment: - VIRTUAL_HOST=oleg.local - WORDPRESS_DB_NAME=wpdb - WORDPRESS_TABLE_PREFIX=wp_ - WORDPRESS_DB_HOST=mysql - WORDPRESS_DB_PORT=3312 - WORDPRESS_DB_PASSWORD=example nginx: image: nginx:latest ports: - '80:80' volumes: - ./nginx:/etc/nginx/conf.d - ./logs/nginx:/var/log/nginx - ./wordpress:/var/www/html - ./olegs:/var/www/olegs links: - wordpress - olegs restart: always 

 server { listen 80; server_name wp.local; root /var/www/html; index index.php; access_log /var/log/nginx/general-access.log; error_log /var/log/nginx/general-error.log; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass wordpress:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } } server { listen 80; server_name oleg.local; root /var/www/olegs; index index.php; access_log /var/log/nginx/olegs-access.log; error_log /var/log/nginx/olegs-error.log; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass olegs:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } } 

我总是得到:

 2017/06/26 07:44:18 [error] 9#9: *26 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.17.0.1, server: oleg.local, request: "GET / HTTP/1.1", upstream: "fastcgi://172.17.0.8:9000", host: "oleg.local" 

对于第二个网站。 (第一个仍然按预期工作)。

不知道这里的configuration有什么问题