forked from HyperIoT-Labs/HyperIoT-UI
-
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
1 parent
cdad508
commit 8a37b27
Showing
3 changed files
with
111 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,9 @@ | ||
FROM nginx:1.17 | ||
|
||
WORKDIR ./ | ||
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.tmpl | ||
COPY ./dist/hyperiot /usr/share/nginx/html | ||
|
||
CMD /bin/sh -c "export DOLLAR=$ && envsubst < /etc/nginx/conf.d/default.tmpl > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' " |
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,74 @@ | ||
worker_processes 2; | ||
|
||
pid /var/run/nginx.pid; | ||
# [ debug | info | notice | warn | error | crit ] | ||
error_log /var/log/nginx.error_log info; | ||
|
||
events { | ||
worker_connections 2000; | ||
use epoll; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
|
||
|
||
## | ||
# LOG | ||
## | ||
|
||
# Log format. Other NGINX variables ($variable) can be used as you wish. | ||
log_format main '$remote_addr - $remote_user [$time_local] ' | ||
'"$request" $status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
# Access log: path and type. | ||
access_log dnginx_access.log main; | ||
# Error log: path and type. | ||
error_log /var/log/nginx_error.log debug; | ||
|
||
## | ||
# TCP | ||
## | ||
|
||
# Optimizes data transfer copying data between one file descriptor and another | ||
# instead of reading and copying data to/from user space. | ||
sendfile on; | ||
# Causes NGINX to attempt to send its HTTP response head in one packet, | ||
# instead of using partial frames. This is useful for prepending headers before calling sendfile, | ||
# or for throughput optimization. | ||
tcp_nopush on; | ||
# Disables the Nagle algorithm. | ||
# It's useful for sending frequent small bursts of data in real time. | ||
tcp_nodelay off; | ||
# Timeout during which a keep-alive client connection will stay open to serve | ||
# all the requested files from the server side. | ||
keepalive_timeout 30s; | ||
# If a client does not receive anything within the time set in this directive, a connection is closed. | ||
send_timeout 60s; | ||
|
||
## | ||
# GZIP | ||
## | ||
|
||
# In production you MUST set gzip to "on" in order to save bandwidth. Web browsers | ||
# which handle compressed files (all recent ones do) will get a very smaller version | ||
# of the server response. | ||
gzip on; | ||
# Enables compression for a given HTTP request version. | ||
gzip_http_version 1.0; | ||
# Compression level 1 (fastest) to 9 (slowest). | ||
gzip_comp_level 6; | ||
# Enables compression for all proxied requests. | ||
gzip_proxied any; | ||
# Minimum length of the response (bytes). Responses shorter than this length will not be compressed. | ||
gzip_min_length 10000; | ||
# Enables compression for additional MIME-types. | ||
gzip_types text/plain text/css application/x-javascript text/xml | ||
application/xml application/xml+rss text/javascript; | ||
# Disables gzip compression for User-Agents matching the given regular expression. | ||
# Is this case we've disabled gzip for old versions of the IE that don't support compressed responses. | ||
gzip_disable "MSIE [1-6] \."; | ||
|
||
# Load modular configuration files from the /etc/nginx/conf.d directory. | ||
include /etc/nginx/conf.d/*.conf; | ||
} |
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,28 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
#WebSocket reverse proxy configuration | ||
location /hyperiot/ws { | ||
resolver 127.0.0.1 [::1]; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade ${DOLLAR}http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_pass "${API_URL}"; | ||
} | ||
|
||
#HyperIoT API Configuration | ||
location /hyperiot { | ||
resolver 127.0.0.1 [::1]; | ||
proxy_http_version 1.1; | ||
proxy_pass "${API_URL}"; | ||
} | ||
|
||
#Angular APP Configuration | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files ${DOLLAR}uri ${DOLLAR}uri/ /index.html =404; | ||
} | ||
} | ||
|