Skip to content

Nginx ​

Nginx serves as the web server for the Magento application, proxying requests to the PHP container via FastCGI.

Configuration ​

The devcontainer's Nginx configuration includes Magento's default nginx.conf.sample from the workspace. This file ships with every Magento installation and contains the built-in Nginx rules for URL rewrites, static file handling, PHP location blocks, and more.

Environment Variables ​

These variables are set in the docker-compose configuration and substituted into the template at startup:

VariableDefaultDescription
MAGENTO2_UPSTREAMphpHostname of the PHP container
MAGENTO2_UPSTREAM_PORT9000FastCGI port on the PHP container
NGINX_PORT8000HTTP listen port inside the container
NGINX_TLS_PORT8443HTTPS listen port inside the container
MAGE_ROOT_DIR/workspacePath to the Magento root directory

Reloading ​

If for any reason you need to make changes to the Nginx configuration, you can reload the web server from the workspace:

bash
docker exec $DEVCONTAINER_NAME-nginx-1 nginx -s reload

TLS ​

A separate TLS template is available at nginx/tls/default.conf.template that adds an HTTPS server block. See the TLS Setup guide for details on enabling it.