Merge pull request #110 from QingdaoU/https

add https helper
This commit is contained in:
李扬 2017-12-16 19:29:44 +08:00 committed by GitHub
commit f70d3cac41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View File

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

View File

@ -19,6 +19,10 @@ location /admin {
try_files $uri $uri/ /index.html =404;
}
location /.well-known {
alias /data/ssl/.well-known;
}
location / {
root /app/dist;
try_files $uri $uri/ /index.html =404;

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