
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
</picture>
</a>
<br>
https://github.com/wayofdev/docker-nginx/tags https://hub.docker.com/repository/docker/wayofdev/nginx
This Docker image provides a streamlined Nginx setup optimized for local PHP development environments.
It's designed to seamlessly integrate with https://github.com/wayofdev/docker-php-dev and other (WOD) images, creating an efficient local development ecosystem for web projects.
k8s-alpine variant for testing Kubernetes setups locallyPerfect for developing Laravel applications, Symfony projects, or any PHP-based web services in a local environment that closely mirrors production setups.
Provides foundation for creating, testing, and debugging your web applications locally.
If you like/use this package, please *** ⭐️ starring it. Thanks!
| Variant | Description |
|---|---|
| dev-alpine | For local development environments, uses 80 and 443 ports. |
| k8s-alpine | Optimized for k8s and local environments, uses 8880 and 8443 ports, rootless. |
bashdocker pull wayofdev/nginx:k8s-alpine-latest
Replace k8s-alpine-latest with your desired type, and tag.
Here's an example docker-compose.yml for a typical setup:
yamlservices: app: image: wayofdev/php-dev:8.3-fpm-alpine-latest container_name: ${COMPOSE_PROJECT_NAME}-app restart: on-failure networks: - default - shared depends_on: - database links: - database volumes: - ./.github/assets:/assets:rw,cached - ./app:/app:rw,cached - ./.env:/app/.env - ~/.composer:/.composer - ~/.ssh:/home/www-data/.ssh environment: FAKETIME: '+2h' XDEBUG_MODE: '${XDEBUG_MODE:-off}' PHIVE_HOME: /app/.phive dns: - 8.8.8.8 extra_hosts: - 'host.docker.internal:host-gateway' web: image: wayofdev/nginx:k8s-alpine-latest container_name: ${COMPOSE_PROJECT_NAME}-web restart: on-failure networks: - default - shared depends_on: - app links: - app volumes: - ./app:/app:rw,cached - ./.env:/app/.env labels: - traefik.enable=true - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.rule=Host(`api.${COMPOSE_PROJECT_NAME}.docker`) - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.entrypoints=websecure - traefik.http.routers.api-${COMPOSE_PROJECT_NAME}-secure.tls=true - traefik.http.services.api-${COMPOSE_PROJECT_NAME}-secure.loadbalancer.server.port=8880 - traefik.docker.network=network.${SHARED_SERVICES_NAMESPACE}
This configuration includes
app service using the wayofdev/php-dev image for PHP processing.web service using a https://github.com/wayofdev/docker-nginx for serving the application.Real-world Example
For a comprehensive, real-world example of how to use this image in a Docker Compose setup, please refer to the https://github.com/wayofdev/laravel-starter-tpl repository. This template provides a fully configured development environment for Laravel projects using the wayofdev/php-dev image.
The Nginx image is pre-configured for optimal performance with PHP applications, but you can customize it further to suit your specific needs.
The default configuration is generated using Ansible templates and includes:
While the configuration is primarily managed through Ansible templates, you can override specific settings:
Environment Variables: The image uses the following environment variables:
| Variable | Default Value | Description |
|---|---|---|
| PHP_UPSTREAM_CONTAINER | app | The name of the PHP-FPM container |
| PHP_UPSTREAM_PORT | 9000 | The port of the PHP-FPM container |
Set these in your docker-compose.yml file:
yamlservices: web: image: wayofdev/nginx:k8s-alpine-latest environment: - PHP_UPSTREAM_CONTAINER=my-php-app - PHP_UPSTREAM_PORT=9001
Volume Mounts: For more extensive customizations, you can mount your own config files:
yamlservices: web: image: wayofdev/nginx:k8s-alpine-latest volumes: - ./custom-nginx.conf:/etc/nginx/nginx.conf - ./custom-default.conf:/etc/nginx/conf.d/default.conf
The image includes self-signed SSL certificates. To use your own:
yamlservices: web: image: wayofdev/nginx:k8s-alpine-latest volumes: - ./certs/cert.pem:/etc/nginx/ssl/cert.pem - ./certs/key.pem:/etc/nginx/ssl/key.pem
For more advanced configurations:
src directorymake generateThis project uses a set of tools for development and testing. The Makefile provides various commands to streamline the development process.
Clone the repository:
bashgit clone git@github.com:wayofdev/docker-nginx.git && \ cd docker-nginx
Ansible is used to generate Dockerfiles and configurations. To generate distributable Dockerfiles from Jinja template source code:
bashmake generate
Build the default image:
bashmake build
This command builds the image specified by the IMAGE_TEMPLATE variable in the Makefile. By default, it's set to k8s-alpine.
Build a specific image:
bashmake build IMAGE_TEMPLATE="k8s-alpine"
Replace 8.3-fpm-alpine with your desired PHP version, type, and OS.
Build all images:
bashmake build IMAGE_TEMPLATE="k8s-alpine" make build IMAGE_TEMPLATE="dev-alpine"
These commands will build all supported image variants.
This project uses a testing approach to ensure the quality and functionality of the Docker images. The primary testing tool is https://github.com/aelsabbahy/goss/tree/master/extras/dgoss, which allows for testing Docker containers.
You can run tests using the following commands:
Test the default image:
bashmake test
This command tests the image specified by the IMAGE_TEMPLATE variable in the Makefile (default is k8s-alpine).
Test a specific image:
bashmake test IMAGE_TEMPLATE="k8s-alpine"
Replace k8s-alpine with your desired image type, and OS.
Test all images:
bashmake test IMAGE_TEMPLATE="k8s-alpine" make test IMAGE_TEMPLATE="dev-alpine"
The test configurations are defined in goss.yaml files, which are generated for each image variant. These files specify the tests to be run, including:
When you run the make test command, the following steps occur:
goss.yaml file against the Docker container.This project has a security policy.
Thank you for ***ing contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:
You are more than welcome. Before contributing, kindly check our contribution guidelines.
https://github.com/wayofdev/docker-nginx/graphs/contributors
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 wayofdev/nginx 相关的常用 Docker 镜像,适用于 反向代理、负载均衡、静态资源服务 等不同场景: