Skip to content

Commit f93d7bb

Browse files
Merge pull request #12 from openspeedtest/beta
v2.1
2 parents 06a2d92 + 23aaaa6 commit f93d7bb

4 files changed

Lines changed: 58 additions & 8 deletions

File tree

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ ENV DOMAIN_NAME=false
99
ENV USER_EMAIL=false
1010
ENV CONFIG=/etc/nginx/conf.d/OpenSpeedTest-Server.conf
1111

12+
ENV CHANGE_CONTAINER_PORTS=false
13+
ENV HTTP_PORT=3000
14+
ENV HTTPS_PORT=3001
15+
ENV SET_USER=101
16+
1217
COPY /files/OpenSpeedTest-Server.conf ${CONFIG}
1318
COPY /files/entrypoint.sh /entrypoint.sh
1419
COPY /files/renew.sh /renew.sh
@@ -62,11 +67,10 @@ RUN chown nginx:nginx /usr/sbin/crond \
6267
RUN touch /etc/crontabs/nginx
6368
RUN chown -R nginx:nginx /etc/crontabs/nginx
6469

65-
USER 101
70+
USER ${SET_USER}
6671

67-
EXPOSE 3000 3001
72+
EXPOSE ${HTTP_PORT} ${HTTPS_PORT}
6873

6974
STOPSIGNAL SIGQUIT
7075

71-
CMD ["/entrypoint.sh"]
72-
76+
CMD ["/entrypoint.sh"]

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,23 @@ services:
118118
- '3001:3001'
119119
image: openspeedtest/latest
120120
````
121+
## Advanced Configuration Options
122+
123+
- Container Port Configuration
124+
125+
To enable port changes, set the `CHANGE_CONTAINER_PORTS` environment variable to `"True"` and provide appropriate values for the following variables.
126+
127+
`CHANGE_CONTAINER_PORTS=True`
128+
129+
`HTTP_PORT=3000`
130+
131+
`HTTPS_PORT=3001`
132+
133+
- Set User
134+
135+
`SET_USER=101`
136+
137+
- Only Allow `CORS Request` from listed domains.
138+
139+
`ALLOW_ONLY=domain1.com;domain2.com;domain3.com`
140+

files/OpenSpeedTest-Server.conf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ server_name _ localhost YOURDOMAIN;
1717
# Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support.
1818
ssl_certificate /etc/ssl/nginx.crt; # Use your own certificate & key
1919
ssl_certificate_key /etc/ssl/nginx.key; # <-- key
20-
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
21-
ssl_protocols TLSv1.1 TLSv1.2;
22-
ssl_session_cache shared:SSL:10m;
23-
ssl_session_timeout 10m;
20+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
21+
ssl_ciphers "ALL";
22+
ssl_prefer_server_ciphers on;
23+
ssl_session_cache shared:SSL:100m;
24+
ssl_session_timeout 1d;
25+
ssl_session_tickets on;
2426
root /usr/share/nginx/html/;
2527
index index.html;
2628
client_max_body_size 35m;

files/entrypoint.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ if [[ $? -ne 0 ]]; then
1212
sed -i '/listen 300/d' ${CONFIG}
1313
fi
1414

15+
16+
if [ "$CHANGE_CONTAINER_PORTS" = True ]; then
17+
if [ "$HTTP_PORT" ]; then
18+
sed -i "s/3000/${HTTP_PORT}/g" ${CONFIG}
19+
if [ $? -eq 0 ]; then
20+
echo "Changed HTTP container port to " ${HTTP_PORT}
21+
else
22+
echo "Failed to change HTTP container port to " ${HTTP_PORT}
23+
fi
24+
25+
fi
26+
27+
if [ "$HTTPS_PORT" ]; then
28+
sed -i "s/3001/${HTTPS_PORT}/g" ${CONFIG}
29+
if [ $? -eq 0 ]; then
30+
echo "Changed HTTPS container port to " ${HTTPS_PORT}
31+
else
32+
echo "Failed to change HTTPS container port to " ${HTTPS_PORT}
33+
fi
34+
35+
fi
36+
fi
37+
38+
1539
Verify_TXT_path="/usr/share/nginx/html/Verify.txt"
1640

1741
if [ "$VERIFY_OWNERSHIP" ]; then

0 commit comments

Comments
 (0)