nginx/root/help.1
2018-10-29 11:11:06 +00:00

139 lines
3.6 KiB
Groff

.TH Nginx 1.12 server and a reverse proxy server container image
.PP
This container image includes Nginx 1.12 server and a reverse server for OpenShift and general usage.
Users can choose RHEL based image.
The RHEL image is available in the Red Hat Container Catalog
\[la]https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/nginx-112-rhel7\[ra]
as registry.access.redhat.com/rhscl/nginx\-112\-rhel7.
.SH Description
.PP
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP
protocols, with a strong focus on high concurrency, performance and low memory usage. The container
image provides a containerized packaging of the nginx 1.12 daemon. The image can be used
as a base image for other applications based on nginx 1.12 web server.
Nginx server image can be extended using source\-to\-image tool.
.SH Usage
.PP
To build a simple sample\-app
\[la]https://github.com/sclorg/nginx-container/tree/master/1.12/test/test-app\[ra] application
using standalone S2I
\[la]https://github.com/openshift/source-to-image\[ra] and then run the
resulting image with Docker
\[la]http://docker.io\[ra] execute:
.IP \(bu 2
.PP
\fBFor RHEL based image\fP
.PP
.RS
.nf
$ s2i build https://github.com/sclorg/nginx\-container.git \-\-context\-dir=1.12/test/test\-app/ rhscl/nginx\-112\-rhel7 nginx\-sample\-app
$ docker run \-p 8080:8080 nginx\-sample\-app
.fi
.RE
.IP \(bu 2
.PP
\fBFor CentOS based image\fP
.PP
.RS
.nf
$ s2i build https://github.com/sclorg/nginx\-container.git \-\-context\-dir=1.12/test/test\-app/ centos/nginx\-112\-centos7 nginx\-sample\-app
$ docker run \-p 8080:8080 nginx\-sample\-app
.fi
.RE
.PP
\fBAccessing the application:\fP
.PP
.RS
.nf
$ curl 127.0.0.1:8080
.fi
.RE
.SH S2I build support
.PP
Nginx server image can be extended using S2I tool (see Usage section).
S2I build folder structure:
.PP
\fB\fB\fC\&./nginx.conf\fR\fP\-\-
The main nginx configuration file
.PP
\fB\fB\fC\&./nginx\-\&cfg/*.conf\fR\fP
.br
Should contain all nginx configuration we want to include into image
.PP
\fB\fB\fC\&./nginx\-\&default\-\&cfg/*.conf\fR\fP
.br
Contains any nginx config snippets to include in the default server block
.PP
\fB\fB\fC\&./nginx\-\&start/*.sh\fR\fP
.br
Contains shell scripts that are sourced right before nginx is launched
.PP
\fB\fB\fC\&./\fR\fP
.br
Should contain nginx application source code
.SH Environment variables and volumes
.PP
The nginx container image supports the following configuration variable, which can be set by using the \fB\fC\-e\fR option with the docker run command:
.PP
\fB\fB\fCNGINX\_LOG\_TO\_VOLUME\fR\fP
.br
When \fB\fCNGINX\_LOG\_TO\_VOLUME\fR is set, nginx logs into \fB\fC/var/opt/rh/rh\-nginx112/log/nginx/\fR
.PP
You can mount your own web root like this:
.PP
.RS
.nf
$ docker run \-v <DIR>:/var/www/html/ <container>
.fi
.RE
.PP
You can replace <DIR> with location of your web root. Please note that this has to be an \fBabsolute\fP path, due to Docker requirements.
.SH Troubleshooting
.PP
By default, nginx logs into standard output, so the log is available in the container log. The log can be examined by running:
.PP
.RS
.nf
docker logs <container>
.fi
.RE
.PP
\fBIf \fB\fCNGINX\_LOG\_TO\_VOLUME\fR variable is set, nginx logs into \fB\fC/var/opt/rh/rh\-nginx112/log/nginx/\fR, which can be mounted to host system using the container volumes.\fP
.SH See also
.PP
Dockerfile and other sources for this container image are available on
\[la]https://github.com/sclorg/nginx-container\[ra]\&.
In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile
for RHEL is called Dockerfile.rhel7.