added sample nginx to image
9 files changed, +310 -1
+1-0Dockerfile
| @@ -5,6 +5,7 @@ RUN mkdir /run/postgresql | ||
| 5 | 5 | RUN chown postgres:postgres /run/postgresql |
| 6 | 6 | |
| 7 | 7 | COPY docker-entrypoint.sh / |
| 8 | +COPY sample /sample | |
| 8 | 9 | RUN chmod 777 /docker-entrypoint.sh |
| 9 | 10 | ENTRYPOINT [ "/docker-entrypoint.sh" ] |
| 10 | 11 |
+5-1docker-entrypoint.sh
| @@ -18,11 +18,15 @@ echo 'Postgres Ready' | ||
| 18 | 18 | EOF |
| 19 | 19 | |
| 20 | 20 | # take care of nginx business |
| 21 | +if [ ! `ls /etc/nginx` ];then | |
| 22 | + echo 'Moving sample into nginx' | |
| 23 | + cp -r /sample/nginx/* /etc/nginx | |
| 24 | +fi | |
| 21 | 25 | nginx |
| 22 | 26 | tail -f /var/log/nginx/access.log & |
| 23 | 27 | |
| 24 | 28 | # take care of redis |
| 25 | -redis-server & | |
| 29 | +redis-server > /dev/null & | |
| 26 | 30 | |
| 27 | 31 | # run the cmd |
| 28 | 32 | $@ |
+26-0sample/nginx/fastcgi.conf
| @@ -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; |
+25-0sample/nginx/fastcgi_params
| @@ -0,0 +1,25 @@ | ||
| 1 | + | |
| 2 | +fastcgi_param QUERY_STRING $query_string; | |
| 3 | +fastcgi_param REQUEST_METHOD $request_method; | |
| 4 | +fastcgi_param CONTENT_TYPE $content_type; | |
| 5 | +fastcgi_param CONTENT_LENGTH $content_length; | |
| 6 | + | |
| 7 | +fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
| 8 | +fastcgi_param REQUEST_URI $request_uri; | |
| 9 | +fastcgi_param DOCUMENT_URI $document_uri; | |
| 10 | +fastcgi_param DOCUMENT_ROOT $document_root; | |
| 11 | +fastcgi_param SERVER_PROTOCOL $server_protocol; | |
| 12 | +fastcgi_param REQUEST_SCHEME $scheme; | |
| 13 | +fastcgi_param HTTPS $https if_not_empty; | |
| 14 | + | |
| 15 | +fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
| 16 | +fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
| 17 | + | |
| 18 | +fastcgi_param REMOTE_ADDR $remote_addr; | |
| 19 | +fastcgi_param REMOTE_PORT $remote_port; | |
| 20 | +fastcgi_param SERVER_ADDR $server_addr; | |
| 21 | +fastcgi_param SERVER_PORT $server_port; | |
| 22 | +fastcgi_param SERVER_NAME $server_name; | |
| 23 | + | |
| 24 | +# PHP only, required if PHP was built with --enable-force-cgi-redirect | |
| 25 | +fastcgi_param REDIRECT_STATUS 200; |
+17-0sample/nginx/http.d/default.conf
| @@ -0,0 +1,17 @@ | ||
| 1 | +# This is a default site configuration which will simply return 404, preventing | |
| 2 | +# chance access to any other virtualhost. | |
| 3 | + | |
| 4 | +server { | |
| 5 | + listen 80 default_server; | |
| 6 | + listen [::]:80 default_server; | |
| 7 | + | |
| 8 | + # Everything is a 404 | |
| 9 | + location / { | |
| 10 | + return 404; | |
| 11 | + } | |
| 12 | + | |
| 13 | + # You may need this to prevent return 404 recursion. | |
| 14 | + location = /404.html { | |
| 15 | + internal; | |
| 16 | + } | |
| 17 | +} |
+99-0sample/nginx/mime.types
| @@ -0,0 +1,99 @@ | ||
| 1 | + | |
| 2 | +types { | |
| 3 | + text/html html htm shtml; | |
| 4 | + text/css css; | |
| 5 | + text/xml xml; | |
| 6 | + image/gif gif; | |
| 7 | + image/jpeg jpeg jpg; | |
| 8 | + application/javascript js; | |
| 9 | + application/atom+xml atom; | |
| 10 | + application/rss+xml rss; | |
| 11 | + | |
| 12 | + text/mathml mml; | |
| 13 | + text/plain txt; | |
| 14 | + text/vnd.sun.j2me.app-descriptor jad; | |
| 15 | + text/vnd.wap.wml wml; | |
| 16 | + text/x-component htc; | |
| 17 | + | |
| 18 | + image/avif avif; | |
| 19 | + image/png png; | |
| 20 | + image/svg+xml svg svgz; | |
| 21 | + image/tiff tif tiff; | |
| 22 | + image/vnd.wap.wbmp wbmp; | |
| 23 | + image/webp webp; | |
| 24 | + image/x-icon ico; | |
| 25 | + image/x-jng jng; | |
| 26 | + image/x-ms-bmp bmp; | |
| 27 | + | |
| 28 | + font/woff woff; | |
| 29 | + font/woff2 woff2; | |
| 30 | + | |
| 31 | + application/java-archive jar war ear; | |
| 32 | + application/json json; | |
| 33 | + application/mac-binhex40 hqx; | |
| 34 | + application/msword doc; | |
| 35 | + application/pdf pdf; | |
| 36 | + application/postscript ps eps ai; | |
| 37 | + application/rtf rtf; | |
| 38 | + application/vnd.apple.mpegurl m3u8; | |
| 39 | + application/vnd.google-earth.kml+xml kml; | |
| 40 | + application/vnd.google-earth.kmz kmz; | |
| 41 | + application/vnd.ms-excel xls; | |
| 42 | + application/vnd.ms-fontobject eot; | |
| 43 | + application/vnd.ms-powerpoint ppt; | |
| 44 | + application/vnd.oasis.opendocument.graphics odg; | |
| 45 | + application/vnd.oasis.opendocument.presentation odp; | |
| 46 | + application/vnd.oasis.opendocument.spreadsheet ods; | |
| 47 | + application/vnd.oasis.opendocument.text odt; | |
| 48 | + application/vnd.openxmlformats-officedocument.presentationml.presentation | |
| 49 | + pptx; | |
| 50 | + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | |
| 51 | + xlsx; | |
| 52 | + application/vnd.openxmlformats-officedocument.wordprocessingml.document | |
| 53 | + docx; | |
| 54 | + application/vnd.wap.wmlc wmlc; | |
| 55 | + application/wasm wasm; | |
| 56 | + application/x-7z-compressed 7z; | |
| 57 | + application/x-cocoa cco; | |
| 58 | + application/x-java-archive-diff jardiff; | |
| 59 | + application/x-java-jnlp-file jnlp; | |
| 60 | + application/x-makeself run; | |
| 61 | + application/x-perl pl pm; | |
| 62 | + application/x-pilot prc pdb; | |
| 63 | + application/x-rar-compressed rar; | |
| 64 | + application/x-redhat-package-manager rpm; | |
| 65 | + application/x-sea sea; | |
| 66 | + application/x-shockwave-flash swf; | |
| 67 | + application/x-stuffit sit; | |
| 68 | + application/x-tcl tcl tk; | |
| 69 | + application/x-x509-ca-cert der pem crt; | |
| 70 | + application/x-xpinstall xpi; | |
| 71 | + application/xhtml+xml xhtml; | |
| 72 | + application/xspf+xml xspf; | |
| 73 | + application/zip zip; | |
| 74 | + | |
| 75 | + application/octet-stream bin exe dll; | |
| 76 | + application/octet-stream deb; | |
| 77 | + application/octet-stream dmg; | |
| 78 | + application/octet-stream iso img; | |
| 79 | + application/octet-stream msi msp msm; | |
| 80 | + | |
| 81 | + audio/midi mid midi kar; | |
| 82 | + audio/mpeg mp3; | |
| 83 | + audio/ogg ogg; | |
| 84 | + audio/x-m4a m4a; | |
| 85 | + audio/x-realaudio ra; | |
| 86 | + | |
| 87 | + video/3gpp 3gpp 3gp; | |
| 88 | + video/mp2t ts; | |
| 89 | + video/mp4 mp4; | |
| 90 | + video/mpeg mpeg mpg; | |
| 91 | + video/quicktime mov; | |
| 92 | + video/webm webm; | |
| 93 | + video/x-flv flv; | |
| 94 | + video/x-m4v m4v; | |
| 95 | + video/x-mng mng; | |
| 96 | + video/x-ms-asf asx asf; | |
| 97 | + video/x-ms-wmv wmv; | |
| 98 | + video/x-msvideo avi; | |
| 99 | +} |
+103-0sample/nginx/nginx.conf
| @@ -0,0 +1,103 @@ | ||
| 1 | +# /etc/nginx/nginx.conf | |
| 2 | + | |
| 3 | +user nginx; | |
| 4 | + | |
| 5 | +# Set number of worker processes automatically based on number of CPU cores. | |
| 6 | +worker_processes auto; | |
| 7 | + | |
| 8 | +# Enables the use of JIT for regular expressions to speed-up their processing. | |
| 9 | +pcre_jit on; | |
| 10 | + | |
| 11 | +# Configures default error logger. | |
| 12 | +error_log /var/log/nginx/error.log warn; | |
| 13 | + | |
| 14 | +# Includes files with directives to load dynamic modules. | |
| 15 | +include /etc/nginx/modules/*.conf; | |
| 16 | + | |
| 17 | +# Include files with config snippets into the root context. | |
| 18 | +include /etc/nginx/conf.d/*.conf; | |
| 19 | + | |
| 20 | +events { | |
| 21 | + # The maximum number of simultaneous connections that can be opened by | |
| 22 | + # a worker process. | |
| 23 | + worker_connections 1024; | |
| 24 | +} | |
| 25 | + | |
| 26 | +http { | |
| 27 | + # Includes mapping of file name extensions to MIME types of responses | |
| 28 | + # and defines the default type. | |
| 29 | + include /etc/nginx/mime.types; | |
| 30 | + default_type application/octet-stream; | |
| 31 | + | |
| 32 | + # Name servers used to resolve names of upstream servers into addresses. | |
| 33 | + # It's also needed when using tcpsocket and udpsocket in Lua modules. | |
| 34 | + #resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001; | |
| 35 | + | |
| 36 | + # Don't tell nginx version to the clients. Default is 'on'. | |
| 37 | + server_tokens off; | |
| 38 | + | |
| 39 | + # Specifies the maximum accepted body size of a client request, as | |
| 40 | + # indicated by the request header Content-Length. If the stated content | |
| 41 | + # length is greater than this size, then the client receives the HTTP | |
| 42 | + # error code 413. Set to 0 to disable. Default is '1m'. | |
| 43 | + client_max_body_size 1m; | |
| 44 | + | |
| 45 | + # Sendfile copies data between one FD and other from within the kernel, | |
| 46 | + # which is more efficient than read() + write(). Default is off. | |
| 47 | + sendfile on; | |
| 48 | + | |
| 49 | + # Causes nginx to attempt to send its HTTP response head in one packet, | |
| 50 | + # instead of using partial frames. Default is 'off'. | |
| 51 | + tcp_nopush on; | |
| 52 | + | |
| 53 | + | |
| 54 | + # Enables the specified protocols. Default is TLSv1 TLSv1.1 TLSv1.2. | |
| 55 | + # TIP: If you're not obligated to support ancient clients, remove TLSv1.1. | |
| 56 | + ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; | |
| 57 | + | |
| 58 | + # Path of the file with Diffie-Hellman parameters for EDH ciphers. | |
| 59 | + # TIP: Generate with: `openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048` | |
| 60 | + #ssl_dhparam /etc/ssl/nginx/dh2048.pem; | |
| 61 | + | |
| 62 | + # Specifies that our cipher suits should be preferred over client ciphers. | |
| 63 | + # Default is 'off'. | |
| 64 | + ssl_prefer_server_ciphers on; | |
| 65 | + | |
| 66 | + # Enables a shared SSL cache with size that can hold around 8000 sessions. | |
| 67 | + # Default is 'none'. | |
| 68 | + ssl_session_cache shared:SSL:2m; | |
| 69 | + | |
| 70 | + # Specifies a time during which a client may reuse the session parameters. | |
| 71 | + # Default is '5m'. | |
| 72 | + ssl_session_timeout 1h; | |
| 73 | + | |
| 74 | + # Disable TLS session tickets (they are insecure). Default is 'on'. | |
| 75 | + ssl_session_tickets off; | |
| 76 | + | |
| 77 | + | |
| 78 | + # Enable gzipping of responses. | |
| 79 | + #gzip on; | |
| 80 | + | |
| 81 | + # Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'. | |
| 82 | + gzip_vary on; | |
| 83 | + | |
| 84 | + | |
| 85 | + # Helper variable for proxying websockets. | |
| 86 | + map $http_upgrade $connection_upgrade { | |
| 87 | + default upgrade; | |
| 88 | + '' close; | |
| 89 | + } | |
| 90 | + | |
| 91 | + | |
| 92 | + # Specifies the main log format. | |
| 93 | + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
| 94 | + '$status $body_bytes_sent "$http_referer" ' | |
| 95 | + '"$http_user_agent" "$http_x_forwarded_for"'; | |
| 96 | + | |
| 97 | + # Sets the path, format, and configuration for a buffered log write. | |
| 98 | + access_log /var/log/nginx/access.log main; | |
| 99 | + | |
| 100 | + | |
| 101 | + # Includes virtual hosts configs. | |
| 102 | + include /etc/nginx/http.d/*.conf; | |
| 103 | +} |
+17-0sample/nginx/scgi_params
| @@ -0,0 +1,17 @@ | ||
| 1 | + | |
| 2 | +scgi_param REQUEST_METHOD $request_method; | |
| 3 | +scgi_param REQUEST_URI $request_uri; | |
| 4 | +scgi_param QUERY_STRING $query_string; | |
| 5 | +scgi_param CONTENT_TYPE $content_type; | |
| 6 | + | |
| 7 | +scgi_param DOCUMENT_URI $document_uri; | |
| 8 | +scgi_param DOCUMENT_ROOT $document_root; | |
| 9 | +scgi_param SCGI 1; | |
| 10 | +scgi_param SERVER_PROTOCOL $server_protocol; | |
| 11 | +scgi_param REQUEST_SCHEME $scheme; | |
| 12 | +scgi_param HTTPS $https if_not_empty; | |
| 13 | + | |
| 14 | +scgi_param REMOTE_ADDR $remote_addr; | |
| 15 | +scgi_param REMOTE_PORT $remote_port; | |
| 16 | +scgi_param SERVER_PORT $server_port; | |
| 17 | +scgi_param SERVER_NAME $server_name; |
+17-0sample/nginx/uwsgi_params
| @@ -0,0 +1,17 @@ | ||
| 1 | + | |
| 2 | +uwsgi_param QUERY_STRING $query_string; | |
| 3 | +uwsgi_param REQUEST_METHOD $request_method; | |
| 4 | +uwsgi_param CONTENT_TYPE $content_type; | |
| 5 | +uwsgi_param CONTENT_LENGTH $content_length; | |
| 6 | + | |
| 7 | +uwsgi_param REQUEST_URI $request_uri; | |
| 8 | +uwsgi_param PATH_INFO $document_uri; | |
| 9 | +uwsgi_param DOCUMENT_ROOT $document_root; | |
| 10 | +uwsgi_param SERVER_PROTOCOL $server_protocol; | |
| 11 | +uwsgi_param REQUEST_SCHEME $scheme; | |
| 12 | +uwsgi_param HTTPS $https if_not_empty; | |
| 13 | + | |
| 14 | +uwsgi_param REMOTE_ADDR $remote_addr; | |
| 15 | +uwsgi_param REMOTE_PORT $remote_port; | |
| 16 | +uwsgi_param SERVER_PORT $server_port; | |
| 17 | +uwsgi_param SERVER_NAME $server_name; |