Back to Testcontainers Java

Nginx Module

docs/modules/nginx.md

2.0.51.3 KB
Original Source

Nginx Module

Nginx is a web server, reverse proxy and mail proxy and http cache.

Usage example

The following example shows how to start Nginx.

<!--codeinclude-->

Creating a Nginx container inside_block:creatingContainer

<!--/codeinclude-->

How to add custom content to the Nginx server.

<!--codeinclude-->

Creating the static content to serve inside_block:addCustomContent

<!--/codeinclude-->

And how to query the Nginx server for the custom content added.

<!--codeinclude-->

Creating the static content to serve inside_block:getFromNginxServer

<!--/codeinclude-->

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

=== "Gradle" groovy testImplementation "org.testcontainers:testcontainers-nginx:{{latest_version}}" === "Maven" xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-nginx</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>