commit 4b3f5635f3253da0bb25c97defe87d766ade965c Author: paulmataruso Date: Sat Oct 26 17:03:15 2024 +0000 First Upload diff --git a/README.md b/README.md new file mode 100644 index 0000000..b96ea55 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Docker-Compose stack with nginx, this stack will expose the entire /etc/nginx folder, as well as the webroot html folder. See compose file for example + +Copy .env.example to .env and define + +HTTP_PORT=8888 +HTTPS_PORT=8889 + + +Use whatever ports you need to. diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2b83f0a --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +version: '3' + +services: + nginx: + image: nginx:latest + ports: + - ${HTTP_PORT}:80 + - ${HTTPS_PORT}:443 + volumes: + - ./docker-persist/html:/usr/share/nginx/html #Expose HTML webroot to host + - ./docker-persist/nginx:/etc/nginx #Expose nging conf folder to host + - ./docker-persist/log:/var/log/nginx #Expose nginx log folder to host + restart: always diff --git a/docker-persist/html/index.html b/docker-persist/html/index.html new file mode 100644 index 0000000..e8f5622 --- /dev/null +++ b/docker-persist/html/index.html @@ -0,0 +1,23 @@ + + + +Welcome to nginx! + + + +

Welcome to nginx!

+

If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.

+ +

For online documentation and support please refer to +nginx.org.
+Commercial support is available at +nginx.com.

+ +

Thank you for using nginx.

+ + diff --git a/docker-persist/log/access.log b/docker-persist/log/access.log new file mode 100644 index 0000000..bfe9b87 --- /dev/null +++ b/docker-persist/log/access.log @@ -0,0 +1,2 @@ +172.16.0.166 - - [26/Oct/2024:17:00:43 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0" "-" +172.16.0.166 - - [26/Oct/2024:17:00:43 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "http://172.16.1.65:9898/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0" "-" diff --git a/docker-persist/log/error.log b/docker-persist/log/error.log new file mode 100644 index 0000000..129ff3f --- /dev/null +++ b/docker-persist/log/error.log @@ -0,0 +1,105 @@ +2024/10/26 16:59:57 [notice] 1#1: using the "epoll" event method +2024/10/26 16:59:57 [notice] 1#1: nginx/1.27.2 +2024/10/26 16:59:57 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) +2024/10/26 16:59:57 [notice] 1#1: OS: Linux 5.15.0-122-generic +2024/10/26 16:59:57 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 +2024/10/26 16:59:57 [notice] 1#1: start worker processes +2024/10/26 16:59:57 [notice] 1#1: start worker process 22 +2024/10/26 16:59:57 [notice] 1#1: start worker process 23 +2024/10/26 16:59:57 [notice] 1#1: start worker process 24 +2024/10/26 16:59:57 [notice] 1#1: start worker process 25 +2024/10/26 16:59:57 [notice] 1#1: start worker process 26 +2024/10/26 16:59:57 [notice] 1#1: start worker process 27 +2024/10/26 16:59:57 [notice] 1#1: start worker process 28 +2024/10/26 16:59:57 [notice] 1#1: start worker process 29 +2024/10/26 16:59:57 [notice] 1#1: start worker process 30 +2024/10/26 16:59:57 [notice] 1#1: start worker process 31 +2024/10/26 16:59:57 [notice] 1#1: start worker process 32 +2024/10/26 16:59:57 [notice] 1#1: start worker process 33 +2024/10/26 16:59:57 [notice] 1#1: start worker process 34 +2024/10/26 16:59:57 [notice] 1#1: start worker process 35 +2024/10/26 16:59:57 [notice] 1#1: start worker process 36 +2024/10/26 16:59:57 [notice] 1#1: start worker process 37 +2024/10/26 17:00:43 [error] 22#22: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.16.0.166, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "172.16.1.65:9898", referrer: "http://172.16.1.65:9898/" +2024/10/26 17:00:55 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down +2024/10/26 17:00:55 [notice] 22#22: gracefully shutting down +2024/10/26 17:00:55 [notice] 23#23: gracefully shutting down +2024/10/26 17:00:55 [notice] 25#25: gracefully shutting down +2024/10/26 17:00:55 [notice] 24#24: gracefully shutting down +2024/10/26 17:00:55 [notice] 25#25: exiting +2024/10/26 17:00:55 [notice] 24#24: exiting +2024/10/26 17:00:55 [notice] 22#22: exiting +2024/10/26 17:00:55 [notice] 25#25: exit +2024/10/26 17:00:55 [notice] 22#22: exit +2024/10/26 17:00:55 [notice] 24#24: exit +2024/10/26 17:00:55 [notice] 26#26: gracefully shutting down +2024/10/26 17:00:55 [notice] 34#34: gracefully shutting down +2024/10/26 17:00:55 [notice] 26#26: exiting +2024/10/26 17:00:55 [notice] 35#35: gracefully shutting down +2024/10/26 17:00:55 [notice] 34#34: exiting +2024/10/26 17:00:55 [notice] 30#30: gracefully shutting down +2024/10/26 17:00:55 [notice] 35#35: exiting +2024/10/26 17:00:55 [notice] 26#26: exit +2024/10/26 17:00:55 [notice] 30#30: exiting +2024/10/26 17:00:55 [notice] 34#34: exit +2024/10/26 17:00:55 [notice] 35#35: exit +2024/10/26 17:00:55 [notice] 30#30: exit +2024/10/26 17:00:55 [notice] 29#29: gracefully shutting down +2024/10/26 17:00:55 [notice] 29#29: exiting +2024/10/26 17:00:55 [notice] 27#27: gracefully shutting down +2024/10/26 17:00:55 [notice] 29#29: exit +2024/10/26 17:00:55 [notice] 27#27: exiting +2024/10/26 17:00:55 [notice] 27#27: exit +2024/10/26 17:00:55 [notice] 32#32: gracefully shutting down +2024/10/26 17:00:55 [notice] 31#31: gracefully shutting down +2024/10/26 17:00:55 [notice] 31#31: exiting +2024/10/26 17:00:55 [notice] 32#32: exiting +2024/10/26 17:00:55 [notice] 37#37: gracefully shutting down +2024/10/26 17:00:55 [notice] 32#32: exit +2024/10/26 17:00:55 [notice] 31#31: exit +2024/10/26 17:00:55 [notice] 37#37: exiting +2024/10/26 17:00:55 [notice] 37#37: exit +2024/10/26 17:00:55 [notice] 28#28: gracefully shutting down +2024/10/26 17:00:55 [notice] 28#28: exiting +2024/10/26 17:00:55 [notice] 33#33: gracefully shutting down +2024/10/26 17:00:55 [notice] 28#28: exit +2024/10/26 17:00:55 [notice] 33#33: exiting +2024/10/26 17:00:55 [notice] 33#33: exit +2024/10/26 17:00:55 [notice] 36#36: gracefully shutting down +2024/10/26 17:00:55 [notice] 36#36: exiting +2024/10/26 17:00:55 [notice] 36#36: exit +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 35 +2024/10/26 17:00:55 [notice] 1#1: worker process 35 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 37 +2024/10/26 17:00:55 [notice] 1#1: worker process 37 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 27 +2024/10/26 17:00:55 [notice] 1#1: worker process 27 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 30 +2024/10/26 17:00:55 [notice] 1#1: worker process 25 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: worker process 30 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 25 +2024/10/26 17:00:55 [notice] 1#1: worker process 24 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: worker process 28 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: worker process 29 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: worker process 32 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 34 +2024/10/26 17:00:55 [notice] 1#1: worker process 34 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 31 +2024/10/26 17:00:55 [notice] 1#1: worker process 26 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: worker process 31 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 33 +2024/10/26 17:00:55 [notice] 1#1: worker process 33 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 22 +2024/10/26 17:00:55 [notice] 1#1: worker process 22 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received +2024/10/26 17:00:55 [notice] 1#1: signal 17 (SIGCHLD) received from 36 +2024/10/26 17:00:55 [notice] 1#1: worker process 36 exited with code 0 +2024/10/26 17:00:55 [notice] 1#1: signal 29 (SIGIO) received diff --git a/docker-persist/nginx/conf.d/default.conf b/docker-persist/nginx/conf.d/default.conf new file mode 100644 index 0000000..ac54d8e --- /dev/null +++ b/docker-persist/nginx/conf.d/default.conf @@ -0,0 +1,45 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + 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 /usr/share/nginx/html; + } + + # 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/docker-persist/nginx/fastcgi_params b/docker-persist/nginx/fastcgi_params new file mode 100644 index 0000000..28decb9 --- /dev/null +++ b/docker-persist/nginx/fastcgi_params @@ -0,0 +1,25 @@ + +fastcgi_param QUERY_STRING $query_string; +fastcgi_param REQUEST_METHOD $request_method; +fastcgi_param CONTENT_TYPE $content_type; +fastcgi_param CONTENT_LENGTH $content_length; + +fastcgi_param SCRIPT_NAME $fastcgi_script_name; +fastcgi_param REQUEST_URI $request_uri; +fastcgi_param DOCUMENT_URI $document_uri; +fastcgi_param DOCUMENT_ROOT $document_root; +fastcgi_param SERVER_PROTOCOL $server_protocol; +fastcgi_param REQUEST_SCHEME $scheme; +fastcgi_param HTTPS $https if_not_empty; + +fastcgi_param GATEWAY_INTERFACE CGI/1.1; +fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; + +fastcgi_param REMOTE_ADDR $remote_addr; +fastcgi_param REMOTE_PORT $remote_port; +fastcgi_param SERVER_ADDR $server_addr; +fastcgi_param SERVER_PORT $server_port; +fastcgi_param SERVER_NAME $server_name; + +# PHP only, required if PHP was built with --enable-force-cgi-redirect +fastcgi_param REDIRECT_STATUS 200; diff --git a/docker-persist/nginx/mime.types b/docker-persist/nginx/mime.types new file mode 100644 index 0000000..1c00d70 --- /dev/null +++ b/docker-persist/nginx/mime.types @@ -0,0 +1,99 @@ + +types { + text/html html htm shtml; + text/css css; + text/xml xml; + image/gif gif; + image/jpeg jpeg jpg; + application/javascript js; + application/atom+xml atom; + application/rss+xml rss; + + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; + + image/avif avif; + image/png png; + image/svg+xml svg svgz; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/webp webp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + + font/woff woff; + font/woff2 woff2; + + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.apple.mpegurl m3u8; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/vnd.ms-excel xls; + application/vnd.ms-fontobject eot; + application/vnd.ms-powerpoint ppt; + application/vnd.oasis.opendocument.graphics odg; + application/vnd.oasis.opendocument.presentation odp; + application/vnd.oasis.opendocument.spreadsheet ods; + application/vnd.oasis.opendocument.text odt; + application/vnd.openxmlformats-officedocument.presentationml.presentation + pptx; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + xlsx; + application/vnd.openxmlformats-officedocument.wordprocessingml.document + docx; + application/vnd.wap.wmlc wmlc; + application/wasm wasm; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/xspf+xml xspf; + application/zip zip; + + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + application/octet-stream iso img; + application/octet-stream msi msp msm; + + audio/midi mid midi kar; + audio/mpeg mp3; + audio/ogg ogg; + audio/x-m4a m4a; + audio/x-realaudio ra; + + video/3gpp 3gpp 3gp; + video/mp2t ts; + video/mp4 mp4; + video/mpeg mpeg mpg; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-m4v m4v; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; +} diff --git a/docker-persist/nginx/modules b/docker-persist/nginx/modules new file mode 120000 index 0000000..4b9b33f --- /dev/null +++ b/docker-persist/nginx/modules @@ -0,0 +1 @@ +/usr/lib/nginx/modules \ No newline at end of file diff --git a/docker-persist/nginx/nginx.conf b/docker-persist/nginx/nginx.conf new file mode 100644 index 0000000..5e076aa --- /dev/null +++ b/docker-persist/nginx/nginx.conf @@ -0,0 +1,32 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + 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 /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/docker-persist/nginx/scgi_params b/docker-persist/nginx/scgi_params new file mode 100644 index 0000000..6d4ce4f --- /dev/null +++ b/docker-persist/nginx/scgi_params @@ -0,0 +1,17 @@ + +scgi_param REQUEST_METHOD $request_method; +scgi_param REQUEST_URI $request_uri; +scgi_param QUERY_STRING $query_string; +scgi_param CONTENT_TYPE $content_type; + +scgi_param DOCUMENT_URI $document_uri; +scgi_param DOCUMENT_ROOT $document_root; +scgi_param SCGI 1; +scgi_param SERVER_PROTOCOL $server_protocol; +scgi_param REQUEST_SCHEME $scheme; +scgi_param HTTPS $https if_not_empty; + +scgi_param REMOTE_ADDR $remote_addr; +scgi_param REMOTE_PORT $remote_port; +scgi_param SERVER_PORT $server_port; +scgi_param SERVER_NAME $server_name; diff --git a/docker-persist/nginx/uwsgi_params b/docker-persist/nginx/uwsgi_params new file mode 100644 index 0000000..09c732c --- /dev/null +++ b/docker-persist/nginx/uwsgi_params @@ -0,0 +1,17 @@ + +uwsgi_param QUERY_STRING $query_string; +uwsgi_param REQUEST_METHOD $request_method; +uwsgi_param CONTENT_TYPE $content_type; +uwsgi_param CONTENT_LENGTH $content_length; + +uwsgi_param REQUEST_URI $request_uri; +uwsgi_param PATH_INFO $document_uri; +uwsgi_param DOCUMENT_ROOT $document_root; +uwsgi_param SERVER_PROTOCOL $server_protocol; +uwsgi_param REQUEST_SCHEME $scheme; +uwsgi_param HTTPS $https if_not_empty; + +uwsgi_param REMOTE_ADDR $remote_addr; +uwsgi_param REMOTE_PORT $remote_port; +uwsgi_param SERVER_PORT $server_port; +uwsgi_param SERVER_NAME $server_name; diff --git a/env.example b/env.example new file mode 100644 index 0000000..2ac2b28 --- /dev/null +++ b/env.example @@ -0,0 +1,2 @@ +HTTP_PORT=9898 +HTTPS_PORT=9899