Skip to content

Commit

Permalink
feat(nginx): review and rearrange conf folders
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Sep 4, 2022
1 parent 9ba0c06 commit 08e9b0c
Show file tree
Hide file tree
Showing 24 changed files with 35 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
description: High performance, optimized NGINX for server web applications and api proxy with fast cache.
version:
short: 1
full: 1.21
full: 1.23
- image: tdlib
description: Cross-platform library for building Telegram clients.
version:
Expand Down
12 changes: 7 additions & 5 deletions packages/container/nginx/conf/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ else
exec 3>/dev/null
fi

entrypointDir=/etc/nginx/entrypoint.d/

if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
if /usr/bin/find "/entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /entrypoint.d/ is not empty, will attempt to perform configuration"
if /usr/bin/find "$entrypointDir" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: $entrypointDir is not empty, will attempt to perform configuration"

echo >&3 "$0: Looking for shell scripts in /entrypoint.d/"
find "/entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
echo >&3 "$0: Looking for shell scripts in $entrypointDir"
find "$entrypointDir" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
Expand All @@ -31,7 +33,7 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then

echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /entrypoint.d/, skipping configuration"
echo >&3 "$0: No files found in $entrypointDir, skipping configuration"
fi
fi

Expand Down
13 changes: 0 additions & 13 deletions packages/container/nginx/conf/templates/00-main.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,3 @@ timer_resolution 100ms;

# Defines named thread pools used for multi-threaded reading and sending of files without blocking worker processes.
thread_pool default threads=32 max_queue=65536;

events {
# Specifies the connection processing method to use (https://nginx.org/en/docs/events.html).
# There is normally no need to specify it explicitly, because nginx will by default use the most efficient method.
# use epoll;

# Sets the maximum number of simultaneous connections that can be opened by a worker process.
# Should be < worker_rlimit_nofile.
worker_connections $NGINX_WORKER_CONNECTIONS;

# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
# multi_accept on;
}
12 changes: 12 additions & 0 deletions packages/container/nginx/conf/templates/10-event.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
events {
# Specifies the connection processing method to use (https://nginx.org/en/docs/events.html).
# There is normally no need to specify it explicitly, because nginx will by default use the most efficient method.
# use epoll;

# Sets the maximum number of simultaneous connections that can be opened by a worker process.
# Should be < worker_rlimit_nofile.
worker_connections $NGINX_WORKER_CONNECTIONS;

# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
# multi_accept on;
}
3 changes: 0 additions & 3 deletions packages/container/nginx/conf/templates/10-http.conf.template

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
http {
include /etc/nginx/conf.d/http.d/*.conf;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
map $sent_http_content_type $expires {
default $NGINX_EXPIRES_DEFAULT;
~assets/ $NGINX_EXPIRES_STATIC;
text/html NGINX_EXPIRES_HTML;
text/html $NGINX_EXPIRES_HTML;
text/* $NGINX_EXPIRES_STATIC;
font/* $NGINX_EXPIRES_STATIC;
image/* $NGINX_EXPIRES_STATIC;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_header server Alwatr;
add_header X-Server Alwatr;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server {
listen 80 default_server;
server_name _;
root /var/www/html;

include /etc/nginx/conf.d/location.d/*.conf;
}
4 changes: 2 additions & 2 deletions packages/container/nginx/www/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>..:: Alwatr Web Server ::..</title>
<title>..:: Alwatr Accelerated Web Server ::..</title>
<style>
:root {
--primary-color: #63459e;
Expand Down Expand Up @@ -97,7 +97,7 @@
</head>
<body>
<div class="board">
<h1>Alwatr Web Server</h1>
<h1>Alwatr Accelerated Web Server</h1>
</div>
</body>
</html>

0 comments on commit 08e9b0c

Please sign in to comment.