Skip to content

Commit

Permalink
Merge pull request #12 from openspeedtest/beta
Browse files Browse the repository at this point in the history
v2.1
  • Loading branch information
openspeedtest committed Jul 9, 2023
2 parents 06a2d92 + 23aaaa6 commit f93d7bb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ ENV DOMAIN_NAME=false
ENV USER_EMAIL=false
ENV CONFIG=/etc/nginx/conf.d/OpenSpeedTest-Server.conf

ENV CHANGE_CONTAINER_PORTS=false
ENV HTTP_PORT=3000
ENV HTTPS_PORT=3001
ENV SET_USER=101

COPY /files/OpenSpeedTest-Server.conf ${CONFIG}
COPY /files/entrypoint.sh /entrypoint.sh
COPY /files/renew.sh /renew.sh
Expand Down Expand Up @@ -62,11 +67,10 @@ RUN chown nginx:nginx /usr/sbin/crond \
RUN touch /etc/crontabs/nginx
RUN chown -R nginx:nginx /etc/crontabs/nginx

USER 101
USER ${SET_USER}

EXPOSE 3000 3001
EXPOSE ${HTTP_PORT} ${HTTPS_PORT}

STOPSIGNAL SIGQUIT

CMD ["/entrypoint.sh"]

CMD ["/entrypoint.sh"]
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,23 @@ services:
- '3001:3001'
image: openspeedtest/latest
````
## Advanced Configuration Options

- Container Port Configuration

To enable port changes, set the `CHANGE_CONTAINER_PORTS` environment variable to `"True"` and provide appropriate values for the following variables.

`CHANGE_CONTAINER_PORTS=True`

`HTTP_PORT=3000`

`HTTPS_PORT=3001`

- Set User

`SET_USER=101`

- Only Allow `CORS Request` from listed domains.

`ALLOW_ONLY=domain1.com;domain2.com;domain3.com`

10 changes: 6 additions & 4 deletions files/OpenSpeedTest-Server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ server_name _ localhost YOURDOMAIN;
# Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support.
ssl_certificate /etc/ssl/nginx.crt; # Use your own certificate & key
ssl_certificate_key /etc/ssl/nginx.key; # <-- key
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ALL";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:100m;
ssl_session_timeout 1d;
ssl_session_tickets on;
root /usr/share/nginx/html/;
index index.html;
client_max_body_size 35m;
Expand Down
24 changes: 24 additions & 0 deletions files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ if [[ $? -ne 0 ]]; then
sed -i '/listen 300/d' ${CONFIG}
fi


if [ "$CHANGE_CONTAINER_PORTS" = True ]; then
if [ "$HTTP_PORT" ]; then
sed -i "s/3000/${HTTP_PORT}/g" ${CONFIG}
if [ $? -eq 0 ]; then
echo "Changed HTTP container port to " ${HTTP_PORT}
else
echo "Failed to change HTTP container port to " ${HTTP_PORT}
fi

fi

if [ "$HTTPS_PORT" ]; then
sed -i "s/3001/${HTTPS_PORT}/g" ${CONFIG}
if [ $? -eq 0 ]; then
echo "Changed HTTPS container port to " ${HTTPS_PORT}
else
echo "Failed to change HTTPS container port to " ${HTTPS_PORT}
fi

fi
fi


Verify_TXT_path="/usr/share/nginx/html/Verify.txt"

if [ "$VERIFY_OWNERSHIP" ]; then
Expand Down

0 comments on commit f93d7bb

Please sign in to comment.