-
Create .docker/nginx/etc directory
mkdir -p .docker/nginx/etc directory
-
Copy config files from containers
Connect to the container
docker-compose run deploy bash
Copy the configurations from in container
cp /etc/nginx/conf.d/default.conf /app/.docker/nginx/etc/vhost.conf
Don't forget to exit from the container
root@deploy:/app# exit
[webuser@localhost magento-ce]$
We will be adding a http header that should be visible in the front-end
In .docker/nginx/etc/vhost.conf edit in the PHP Entry Point (near line 142)
# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
# Add the following line
add_header X-hello "Hello World";
Add a docker-compose.override.yml file to the root directory of the project.
version: '2.1'
web:
volumes:
- ./.docker/nginx/etc/vhost.conf:/etc/nginx/conf.d/default.conf
Restart the nginx container
docker-compose restart web
Clear the cache
docker-compose run deploy bin/magento cache:flush
Using your web browser look at the headers for any page.
Response Headers should have the following:
X-hello: Hello World