Skip to content

Commit 52f57d3

Browse files
committed
Added config files for nginx docker.
1 parent b438e7e commit 52f57d3

File tree

4 files changed

+355
-0
lines changed

4 files changed

+355
-0
lines changed

demo-docker/conf/fastcgi.conf

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3+
fastcgi_param QUERY_STRING $query_string;
4+
fastcgi_param REQUEST_METHOD $request_method;
5+
fastcgi_param CONTENT_TYPE $content_type;
6+
fastcgi_param CONTENT_LENGTH $content_length;
7+
8+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
9+
fastcgi_param REQUEST_URI $request_uri;
10+
fastcgi_param DOCUMENT_URI $document_uri;
11+
fastcgi_param DOCUMENT_ROOT $document_root;
12+
fastcgi_param SERVER_PROTOCOL $server_protocol;
13+
fastcgi_param REQUEST_SCHEME $scheme;
14+
fastcgi_param HTTPS $https if_not_empty;
15+
16+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
17+
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
18+
19+
fastcgi_param REMOTE_ADDR $remote_addr;
20+
fastcgi_param REMOTE_PORT $remote_port;
21+
fastcgi_param SERVER_ADDR $server_addr;
22+
fastcgi_param SERVER_PORT $server_port;
23+
fastcgi_param SERVER_NAME $server_name;
24+
25+
# PHP only, required if PHP was built with --enable-force-cgi-redirect
26+
fastcgi_param REDIRECT_STATUS 200;

demo-docker/conf/json_scada_http.conf

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# JSON SCADA real time webserver listening on port 8080
2+
upstream jsonscadarealtimewebserver {
3+
server server_realtime:8080;
4+
keepalive 15;
5+
}
6+
7+
server {
8+
listen 80;
9+
listen [::]:80;
10+
server_name localhost;
11+
server_tokens off;
12+
13+
gzip on;
14+
gzip_buffers 16 8k;
15+
gzip_comp_level 4;
16+
gzip_http_version 1.0;
17+
gzip_min_length 1280;
18+
gzip_types *;
19+
gzip_vary on;
20+
gzip_disable msie6;
21+
22+
charset UTF-8;
23+
24+
# IP-based access control
25+
26+
# allow local access only by default
27+
allow 0.0.0.0;
28+
29+
# to allow more clients/severs, configure the following option
30+
# allow _IP_hmi_client;
31+
# allow _IP_hmi_redundant_server;
32+
33+
deny all;
34+
35+
#location / {
36+
# root "/home/jsonscada/json-scada/src/htdocs/";
37+
# index index.html;
38+
#}
39+
40+
location / {
41+
proxy_set_header X-Forwarded-For $remote_addr;
42+
proxy_set_header X-Real-IP $remote_addr;
43+
proxy_set_header Host $http_host;
44+
proxy_pass http://jsonscadarealtimewebserver/;
45+
}
46+
47+
location /login/ {
48+
proxy_set_header X-Forwarded-For $remote_addr;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_set_header Host $http_host;
51+
proxy_pass http://jsonscadarealtimewebserver/login/;
52+
}
53+
54+
location /admin/ {
55+
proxy_set_header X-Forwarded-For $remote_addr;
56+
proxy_set_header X-Real-IP $remote_addr;
57+
proxy_set_header Host $http_host;
58+
proxy_pass http://jsonscadarealtimewebserver/admin/;
59+
}
60+
61+
# OPC-like Realtime/Hist API
62+
location /Invoke/ {
63+
proxy_set_header X-Forwarded-For $remote_addr;
64+
proxy_set_header X-Real-IP $remote_addr;
65+
proxy_set_header Host $http_host;
66+
proxy_pass http://jsonscadarealtimewebserver/Invoke/;
67+
}
68+
69+
# # reverse proxy, redirect ajax requests to OSHMI webserver.exe
70+
# location /htdocs/shellapi.rjs {
71+
# proxy_pass http://jsonscadarealtimewebserver/htdocs/shellapi.rjs;
72+
# proxy_set_header Host $host;
73+
# proxy_set_header X-Real-IP $remote_addr;
74+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
75+
# }
76+
77+
# reverse proxy, redirect grafana requests (pass it to nodejs server_realtime_auth that redirects to grafana)
78+
location /grafana/ {
79+
proxy_pass http://jsonscadarealtimewebserver/grafana/;
80+
proxy_set_header Host $host;
81+
proxy_set_header X-Real-IP $remote_addr;
82+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
83+
}
84+
85+
# redirect server error pages to the static page /50x.html
86+
#
87+
error_page 500 502 503 504 /50x.html;
88+
location = /50x.html {
89+
root html;
90+
}
91+
92+
# redirect OData metadata url for PowerBI
93+
location ~ (.*)/\$metadata {
94+
rewrite (.*)/\$metadata$ $1?METADATA=1 permanent; break;
95+
return 403;
96+
}
97+
98+
## cache of SVG displays
99+
#location ~ ^/svg/.+(\.svg|\.js)$ {
100+
# add_header Cache-Control "no-cache, must-revalidate";
101+
# etag on;
102+
# root "c:/json-scada/src/htdocs/";
103+
#}
104+
105+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
106+
#
107+
location ~ .php$ {
108+
include fastcgi.conf;
109+
root "/home/jsonscada/json-scada/src/htdocs/";
110+
fastcgi_pass phpbackend;
111+
fastcgi_keep_conn on;
112+
fastcgi_index index.php;
113+
fastcgi_read_timeout 10s;
114+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
115+
}
116+
117+
# deny access to .htaccess files
118+
location ~ /\.ht {
119+
deny all;
120+
}
121+
}
122+
+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
## REMOVE FIRST COLUMN HASHTAGS TO ENABLE NGINX HTTPS SERVER!
2+
## Please regenerate ssl certificates:
3+
4+
# server {
5+
# server_name $hostname;
6+
# server_tokens off;
7+
8+
# listen 443 ssl http2;
9+
# listen [::]:443 ssl http2;
10+
# ssl_certificate /home/jsonscada/json-scada/conf/nginx.crt;
11+
# ssl_certificate_key /home/jsonscada/json-scada/conf/nginx.key;
12+
13+
# #ssl_client_certificate /home/jsonscada/json-scada/conf/ca.crt;
14+
# #ssl_verify_client on;
15+
16+
# gzip on;
17+
# gzip_buffers 16 8k;
18+
# gzip_comp_level 4;
19+
# gzip_http_version 1.0;
20+
# gzip_min_length 1280;
21+
# gzip_types *;
22+
# gzip_vary on;
23+
# gzip_disable msie6;
24+
25+
# #charset koi8-r;
26+
# charset UTF-8;
27+
# #charset ISO-8859-1;
28+
29+
# # IP-based access control
30+
#
31+
# # allow local access only by default
32+
# allow 0.0.0.0;
33+
#
34+
# # to allow more clients/severs, configure the following option
35+
# # allow _IP_hmi_client;
36+
# # allow _IP_hmi_redundant_server;
37+
#
38+
# deny all;
39+
40+
# #location / {
41+
# # root "/home/jsonscada/json-scada/src/htdocs/";
42+
# # index index.html;
43+
# #}
44+
45+
# location / {
46+
# proxy_set_header X-Forwarded-For $remote_addr;
47+
# proxy_set_header X-Real-IP $remote_addr;
48+
# proxy_set_header Host $http_host;
49+
# proxy_pass http://jsonscadarealtimewebserver/;
50+
# }
51+
52+
# location /login/ {
53+
# proxy_set_header X-Forwarded-For $remote_addr;
54+
# proxy_set_header X-Real-IP $remote_addr;
55+
# proxy_set_header Host $http_host;
56+
# proxy_pass http://jsonscadarealtimewebserver/login/;
57+
# }
58+
59+
# location /admin/ {
60+
# proxy_set_header X-Forwarded-For $remote_addr;
61+
# proxy_set_header X-Real-IP $remote_addr;
62+
# proxy_set_header Host $http_host;
63+
# proxy_pass http://jsonscadarealtimewebserver/admin/;
64+
# }
65+
66+
# # OPC-like Realtime/Hist API
67+
# location /Invoke/ {
68+
# proxy_set_header X-Forwarded-For $remote_addr;
69+
# proxy_set_header X-Real-IP $remote_addr;
70+
# proxy_set_header Host $http_host;
71+
# proxy_pass http://jsonscadarealtimewebserver/Invoke/;
72+
# }
73+
74+
# # reverse proxy, redirect grafana requests (pass it to nodejs server_realtime_auth that redirects to grafana)
75+
# location /grafana/ {
76+
# proxy_pass http://jsonscadarealtimewebserver/grafana/;
77+
# proxy_set_header Host $host;
78+
# proxy_set_header X-Real-IP $remote_addr;
79+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
80+
# }
81+
82+
# #error_page 404 /404.html;
83+
84+
# # redirect server error pages to the static page /50x.html
85+
# #
86+
# error_page 500 502 503 504 /50x.html;
87+
# location = /50x.html {
88+
# root html;
89+
# }
90+
91+
# # redirect OData metadata url for PowerBI
92+
# location ~ (.*)/\$metadata {
93+
# rewrite (.*)/\$metadata$ $1?METADATA=1 permanent; break;
94+
# return 403;
95+
# }
96+
97+
# ## cache of SVG displays
98+
# #location ~ ^/svg/.+(\.svg|\.js)$ {
99+
# # add_header Cache-Control "no-cache, must-revalidate";
100+
# # etag on;
101+
# # root "/home/jsonscada/json-scada/src/htdocs/";
102+
# #}
103+
104+
# # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
105+
# #
106+
# location ~ .php$ {
107+
# include fastcgi.conf;
108+
# root "/home/jsonscada/json-scada/src/htdocs/";
109+
# fastcgi_pass phpbackend;
110+
# fastcgi_keep_conn on;
111+
# fastcgi_index index.php;
112+
# fastcgi_read_timeout 10s;
113+
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
114+
# }
115+
# }

demo-docker/conf/nginx.conf

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# For more information on configuration, see:
2+
# * Official English Documentation: http://nginx.org/en/docs/
3+
# * Official Russian Documentation: http://nginx.org/ru/docs/
4+
5+
user nginx;
6+
worker_processes auto;
7+
error_log /var/log/nginx/error.log;
8+
pid /run/nginx.pid;
9+
10+
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
11+
include /usr/share/nginx/modules/*.conf;
12+
13+
events {
14+
worker_connections 1024;
15+
}
16+
17+
http {
18+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19+
'$status $body_bytes_sent "$http_referer" '
20+
'"$http_user_agent" "$http_x_forwarded_for"';
21+
22+
access_log /var/log/nginx/access.log main;
23+
24+
sendfile on;
25+
tcp_nopush on;
26+
tcp_nodelay on;
27+
keepalive_timeout 65;
28+
types_hash_max_size 4096;
29+
30+
include /etc/nginx/mime.types;
31+
default_type application/octet-stream;
32+
33+
# Load modular configuration files from the /etc/nginx/conf.d directory.
34+
# See http://nginx.org/en/docs/ngx_core_module.html#include
35+
# for more information.
36+
include /etc/nginx/conf.d/*.conf;
37+
38+
access_log off;
39+
40+
# FastCGI server listening on port 9000
41+
upstream phpbackend {
42+
server 127.0.0.1:9000;
43+
keepalive 15;
44+
}
45+
46+
# server {
47+
# listen 80;
48+
# listen [::]:80;
49+
# server_name _;
50+
# root /usr/share/nginx/html;
51+
#
52+
# # Load configuration files for the default server block.
53+
# include /etc/nginx/default.d/*.conf;
54+
#
55+
# error_page 404 /404.html;
56+
# location = /404.html {
57+
# }
58+
#
59+
# error_page 500 502 503 504 /50x.html;
60+
# location = /50x.html {
61+
# }
62+
# }
63+
64+
# Settings for a TLS enabled server.
65+
#
66+
# server {
67+
# listen 443 ssl http2;
68+
# listen [::]:443 ssl http2;
69+
# server_name _;
70+
# root /usr/share/nginx/html;
71+
#
72+
# ssl_certificate "/etc/pki/nginx/server.crt";
73+
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
74+
# ssl_session_cache shared:SSL:1m;
75+
# ssl_session_timeout 10m;
76+
# ssl_ciphers PROFILE=SYSTEM;
77+
# ssl_prefer_server_ciphers on;
78+
#
79+
# # Load configuration files for the default server block.
80+
# include /etc/nginx/default.d/*.conf;
81+
#
82+
# error_page 404 /404.html;
83+
# location = /40x.html {
84+
# }
85+
#
86+
# error_page 500 502 503 504 /50x.html;
87+
# location = /50x.html {
88+
# }
89+
# }
90+
91+
}
92+

0 commit comments

Comments
 (0)