use env to force https

This commit is contained in:
virusdefender 2017-12-16 01:38:44 +08:00
parent 417337c4d2
commit 9542b2e5f7
4 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,3 @@
location / {
return 301 https://$host$request_uri;
}

View File

@ -36,7 +36,7 @@ http {
listen 8000 default_server;
server_name _;
include common.conf;
include http_locations.conf;
}
server {
@ -49,7 +49,7 @@ http {
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
include common.conf;
include https_locations.conf;
}
}

8
deploy/run.sh Normal file → Executable file
View File

@ -23,6 +23,14 @@ if [ ! -f "$SSL/server.key" ]; then
-subj "/C=CN/ST=Beijing/L=Beijing/O=Beijing OnlineJudge Technology Co., Ltd./OU=Service Infrastructure Department/CN=`hostname`" -nodes
fi
cd $APP/deploy/nginx
ln -sf locations.conf https_locations.conf
if [ -z "$FORCE_HTTPS" ]; then
ln -sf locations.conf http_locations.conf
else
ln -sf https_redirect.conf http_locations.conf
fi
cd $APP
n=0