How to deploy website to openshift with nginx?

Although Openshift is able to use docker images, it has much more restrictions like no root user. Thus not all docker images can work straight on Openshift. Unfortunately, the official nginx docker image does not work on openshift.

In this post, I will simply go through how to run this Official RedHat nginx image on Openshift and deploy a website onto it.

wordpress reverse proxy headers

When put wordpress blog behind a reverse proxy (e.g. nginx), some headers have to be setup:

1
2
3
4
5
6
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header HTTP_X_FORWARDED_PROTO $scheme;