-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35ade2c
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM nginx:1.10-alpine | ||
|
||
COPY run.sh /root/run.sh | ||
|
||
RUN apk add --no-cache bash jq | ||
|
||
ENTRYPOINT ["/bin/bash", "/root/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
cd /etc/nginx/conf.d | ||
|
||
rm -rf config* test* | ||
|
||
echo "$1" > config | ||
echo "$2" > test | ||
|
||
cat config | ||
cat test | ||
|
||
jq .config config | xargs echo -e > temp_config | ||
|
||
cp default.conf default.conf.bak | ||
|
||
cat temp_config | while read a; do if [[ ! $a = \#* ]]; then echo $a >> temp_delcomment; fi done | ||
config=`cat temp_delcomment` | ||
config="server{ rewrite_log on; listen 80; error_log /var/log/nginx/rewrite.log notice; ${config} }" | ||
echo $config > default.conf | ||
|
||
nginx | ||
|
||
jq -r 'map(.|"wget -s http://127.0.0.1/"+.)[]' test > request.sh | ||
chmod 755 request.sh | ||
sh request.sh | ||
|
||
echo "###START_RESULT###" | ||
cat /var/log/nginx/rewrite.log | ||
echo "###END_RESULT###" | ||
|
||
rm -rf test* temp* config* |