From d4160d03c1b4e2a62f22508714ceb96b1d959aab Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 29 Nov 2021 11:25:58 +0200 Subject: [PATCH] ad config --- .../sec/project/bin/start-nginx.sh | 2 + .../sec/project/config/default.conf | 44 +++++++ .../swarmlab.io/sec/project/config/nginx.conf | 29 +++++ .../sec/project/config/supervisord.conf | 28 ++++ .../sec/project/data-www/index.html | 121 ++++++++++++++++++ .../usr/share/swarmlab.io/sec/swarmlab-sec | 4 + 6 files changed, 228 insertions(+) create mode 100755 install/usr/share/swarmlab.io/sec/project/bin/start-nginx.sh create mode 100644 install/usr/share/swarmlab.io/sec/project/config/default.conf create mode 100644 install/usr/share/swarmlab.io/sec/project/config/nginx.conf create mode 100644 install/usr/share/swarmlab.io/sec/project/config/supervisord.conf create mode 100644 install/usr/share/swarmlab.io/sec/project/data-www/index.html diff --git a/install/usr/share/swarmlab.io/sec/project/bin/start-nginx.sh b/install/usr/share/swarmlab.io/sec/project/bin/start-nginx.sh new file mode 100755 index 0000000..fd591f6 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/bin/start-nginx.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf diff --git a/install/usr/share/swarmlab.io/sec/project/config/default.conf b/install/usr/share/swarmlab.io/sec/project/config/default.conf new file mode 100644 index 0000000..1072e80 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/config/default.conf @@ -0,0 +1,44 @@ +server { + listen 80; + server_name localhost; + + #charset koi8-r; + #access_log /var/log/nginx/log/host.access.log main; + + location / { + root /data/www; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /data/www; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} diff --git a/install/usr/share/swarmlab.io/sec/project/config/nginx.conf b/install/usr/share/swarmlab.io/sec/project/config/nginx.conf new file mode 100644 index 0000000..95505c2 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/config/nginx.conf @@ -0,0 +1,29 @@ +user www-data; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '[$time_local] $remote_user:$remote_addr "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/install/usr/share/swarmlab.io/sec/project/config/supervisord.conf b/install/usr/share/swarmlab.io/sec/project/config/supervisord.conf new file mode 100644 index 0000000..5ee7819 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/config/supervisord.conf @@ -0,0 +1,28 @@ +[unix_http_server] +file=/dev/shm/supervisor.sock ; (the path to the socket file) + +[supervisord] +logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) +logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) +logfile_backups=10 ; (num of main logfile rotation backups;default 10) +loglevel=info ; (log level;default info; others: debug,warn,trace) +pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +nodaemon=false ; (start in foreground if true;default false) +minfds=1024 ; (min. avail startup file descriptors;default 1024) +minprocs=200 ; (min. avail process descriptors;default 200) +user=root ; + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL for a unix socket + +[include] +files = /etc/supervisor/conf.d/*.conf + +[program:nginx] +command=/usr/sbin/nginx +numprocs=1 +autostart=true +autorestart=true diff --git a/install/usr/share/swarmlab.io/sec/project/data-www/index.html b/install/usr/share/swarmlab.io/sec/project/data-www/index.html new file mode 100644 index 0000000..83994b0 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/data-www/index.html @@ -0,0 +1,121 @@ + + + + + Test Page for the Nginx HTTP Server on Fedora + + + + + +

Welcome to nginx on Fedora!

+ +
+

This page is used to test the proper operation of the + nginx HTTP server after it has been + installed. If you can read this page, it means that the + web server installed at this site is working + properly.

+ +
+

Website Administrator

+
+

This is the default index.html page that + is distributed with nginx on + Fedora. It is located in + /data/www.

+ +

You should now put your content in a location of + your choice and edit the root configuration + directive in the nginx + configuration file + /etc/nginx/nginx.conf.

+ + +[ Powered by nginx ]More info here +
+
+ +
+ [ Powered by nginx ] + + [ Powered by Swarmlab.io ] +
+
+ + diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-sec b/install/usr/share/swarmlab.io/sec/swarmlab-sec index 86d5d5a..04063d6 100755 --- a/install/usr/share/swarmlab.io/sec/swarmlab-sec +++ b/install/usr/share/swarmlab.io/sec/swarmlab-sec @@ -294,6 +294,10 @@ services: - ${HYBRID_NETWORK} volumes: - $Wdir/project:/home/docker/project + - $Wdir/project/data-www:/data-www + - $Wdir/project/conf/nginx.conf:/etc/nginx/nginx.conf + - $Wdir/project/conf/default.conf:/etc/nginx/conf.d/default.conf + - $Wdir/project/conf/supervisord.conf:/etc/supervisor/supervisord.conf networks: ${HYBRID_NETWORK}: