Merge pull request #4073 from champjss/master

Change nginx configuration in Docker container based on BASE_URL, instead of moving actual files
This commit is contained in:
kyle
2018-01-05 19:23:24 -06:00
committed by GitHub
2 changed files with 5 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
set -e
BASE_URL=${BASE_URL:-/}
NGINX_ROOT=/usr/share/nginx/html
INDEX_FILE=$NGINX_ROOT/index.html
@@ -22,13 +23,7 @@ replace_or_delete_in_index () {
}
if [ "${BASE_URL}" ]; then
NGINX_WITH_BASE_URL="${NGINX_ROOT}${BASE_URL}"
mkdir -p ${NGINX_WITH_BASE_URL}
mv ${NGINX_ROOT}/*.* ${NGINX_WITH_BASE_URL}/
INDEX_FILE=$NGINX_WITH_BASE_URL/index.html
NGINX_ROOT=$NGINX_WITH_BASE_URL
sed -i "s|location .* {|location $BASE_URL {|g" /etc/nginx/nginx.conf
fi
replace_in_index myApiKeyXXXX123456789 $API_KEY

View File

@@ -15,10 +15,11 @@ http {
server {
listen 8080;
server_name localhost;
index index.html index.htm;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
alias /usr/share/nginx/html/;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';