Skip to content

Commit

Permalink
added django_sample project , nginx conf files for gunicorn and uwsgi…
Browse files Browse the repository at this point in the history
…. updated uwsgi.ini, run.sh, nginx's log style.
  • Loading branch information
bluebamus committed Apr 22, 2021
1 parent 5f2239f commit b942f86
Show file tree
Hide file tree
Showing 7,294 changed files with 30,215 additions and 869,373 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions config/app-server/uwsgi/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[uwsgi]
project = django_test
project = django_sample
username = root

#uid = root
#gid =
#base =/www/py37/django_test/repo
#base =/www/django_sample/django_sample

# Django-related settings
# the base directory (full path)
chdir = /www/py37/django_test/repo
chdir = /www/django_sample

# Django's wsgi file
module = conf.wsgi:application
module = django_sample.wsgi:application


# python path
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
server {
listen 80;
server_name localhost www.localhost;

access_log /log/nginx/django_sample.com.access.log main;
error_log /log/nginx/django_sample.com.error.log warn;

# Django media
location /media {
gzip_static on;
expires max;
#alias /www/django_sample/django_sample/media;
alias /www/django_sample/media; # your Django project's media files - amend as required
#include /etc/nginx/mime.types;
}

location /static {
gzip_static on;
expires max;
#alias /www/django_sample/django_sample/static;
# normally static folder is named as /static
alias /www/django_sample/static; # your Django project's static files - amend as required
#include /etc/nginx/mime.types;
}

location / {
proxy_pass http://gunicorn-app:8000;
# proxy_redirect http:// https://;

}

# Allow Lets Encrypt Domain Validation Program
location ^~ /.well-known/acme-challenge/ {
allow all;
}

# Block dot file (.htaccess .htpasswd .svn .git .env and so on.)
location ~ /\. {
deny all;
}

# Block (log file, binary, certificate, shell script, sql dump file) access.
location ~* \.(log|binary|pem|enc|crt|conf|cnf|sql|sh|key|yml|lock)$ {
deny all;
}

# Block access
location ~* (composer\.json|composer\.lock|composer\.phar|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml|access_log|error_log|gruntfile\.js)$ {
deny all;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
log_not_found off;
access_log off;
}
}
3 changes: 1 addition & 2 deletions config/web-server/nginx/gunicorn/nginx_conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ http {
image/webp
application/font-woff
application/json
application/javascript
;
application/javascript;

include /etc/nginx/proxy_params;
include /etc/nginx/conf.d/*.conf;
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/gunicorn/sample_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ server {
listen portnumber;
server_name domain www.domain;

access_log /log/nginx/filename.com.access.log main;
error_log /log/nginx/filename.com.error.log warn;
access_log /log/nginx/filename.com.gunicorn_access.log main;
error_log /log/nginx/filename.com.gunicorn_error.log warn;

# Django media
location /media {
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/gunicorn/sample_nginx_https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.com.gunicorn_access.log main;
error_log /log/nginx/filename.com.gunicorn_error.log warn;

# Django media
location /media {
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/gunicorn/sample_nginx_proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ server {
listen portnumber;
server_name domain www.domain;

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.gunicorn_proxy_access.log main;
error_log /log/nginx/filename.gunicorn_proxy_error.log warn;
# Log Location. Can be anywhere. Make sure the nginx user defined in /etc/nginx/nginx.conf has r/w permissions

###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.gunicorn_proxy_access.log main;
error_log /log/nginx/filename.gunicorn_proxy_error.log warn;

# # Allow Lets Encrypt Domain Validation Program
# location ^~ /.well-known/acme-challenge/ {
Expand Down
8 changes: 4 additions & 4 deletions config/web-server/nginx/php/conf.d/sample_php_ng.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {
listen 80;
server_name sample.com www.sample.com;
root /www/sample;
server_name localhost;
root /www/php_sample;

server_tokens off;

Expand All @@ -20,8 +20,8 @@ server {
#set same size as post_max_size(php.ini or php_admin_value).
client_max_body_size 10M;

access_log /log/nginx/sample.com.access.log main;
error_log /log/nginx/sample.com.error.log warn;
access_log /log/nginx/php_sample.com.access.log main;
error_log /log/nginx/php_sample.com.error.log warn;

location / {
index index.php index.html;
Expand Down
3 changes: 1 addition & 2 deletions config/web-server/nginx/php/nginx_conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ http {
image/webp
application/font-woff
application/json
application/javascript
;
application/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/proxy_params;
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/php/sample_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ server {
server_name domain www.domain;
root /www/webroot;

access_log /log/nginx/filename.com.access.log main;
error_log /log/nginx/filename.com.error.log warn;
access_log /log/nginx/filename.com.php_access.log main;
error_log /log/nginx/filename.com.php_error.log warn;

location / {
index index.php index.html;
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/php/sample_nginx_https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.com.php_access.log main;
error_log /log/nginx/filename.com.php_error.log warn;

location / {
index index.php index.html;
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/php/sample_nginx_proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ server {
listen portnumber;
server_name domain www.domain;

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.php_proxy_access.log main;
error_log /log/nginx/filename.php_proxy_error.log warn;
# Log Location. Can be anywhere. Make sure the nginx user defined in /etc/nginx/nginx.conf has r/w permissions

###
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/php/sample_nginx_proxy_https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.php_proxy_access.log main;
error_log /log/nginx/filename.php_proxy_error.log warn;

# # Allow Lets Encrypt Domain Validation Program
# location ^~ /.well-known/acme-challenge/ {
Expand Down
75 changes: 75 additions & 0 deletions config/web-server/nginx/uwsgi/conf.d/django_sample_uwsgi_ng.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
server {
listen 80;
server_name localhost www.localhost;

access_log /log/nginx/django_sample.com.access.log main;
error_log /log/nginx/django_sample.com.error.log warn;

# Django media
location /media {
gzip_static on;
expires max;
#alias /www/django_sample/django_sample/media;
alias /www/django_sample/media; # your Django project's media files - amend as required
#include /etc/nginx/mime.types;
}

location /static {
gzip_static on;
expires max;
#alias /www/django_sample/django_sample/static;
# normally static folder is named as /static
alias /www/django_sample/static; # your Django project's static files - amend as required
#include /etc/nginx/mime.types;
}

location / {
uwsgi_pass uwsgi-app:8000;

uwsgi_max_temp_file_size 20480m;
uwsgi_buffering off;
uwsgi_ignore_client_abort on;
uwsgi_buffers 2560 160k;
uwsgi_buffer_size 2560k;
uwsgi_connect_timeout 30s;
uwsgi_send_timeout 30s;
uwsgi_read_timeout 30s;
uwsgi_busy_buffers_size 2560k;
uwsgi_temp_file_write_size 2560k;
proxy_read_timeout 30s;
proxy_connect_timeout 75s;

#proxy_pass http://uwsgi-app:9000;

}

# Allow Lets Encrypt Domain Validation Program
location ^~ /.well-known/acme-challenge/ {
allow all;
}

# Block dot file (.htaccess .htpasswd .svn .git .env and so on.)
location ~ /\. {
deny all;
}

# Block (log file, binary, certificate, shell script, sql dump file) access.
location ~* \.(log|binary|pem|enc|crt|conf|cnf|sql|sh|key|yml|lock)$ {
deny all;
}

# Block access
location ~* (composer\.json|composer\.lock|composer\.phar|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml|access_log|error_log|gruntfile\.js)$ {
deny all;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
log_not_found off;
access_log off;
}
}
3 changes: 1 addition & 2 deletions config/web-server/nginx/uwsgi/nginx_conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ http {
image/webp
application/font-woff
application/json
application/javascript
;
application/javascript;

include /etc/nginx/proxy_params;
include /etc/nginx/uwsgi_params;
Expand Down
8 changes: 4 additions & 4 deletions config/web-server/nginx/uwsgi/sample_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ server {
listen portnumber;
server_name domain www.domain;

access_log /log/nginx/filename.com.access.log main;
error_log /log/nginx/filename.com.error.log warn;
access_log /log/nginx/filename.com.uwsgi_access.log main;
error_log /log/nginx/filename.com.uwsgi_error.log warn;

# Django media
location /media {
gzip_static on;
expires max;
#alias /www/py37/django_test/repo/media;
#alias /www/django_sample/media;
alias webroot/media; # your Django project's media files - amend as required
#include /etc/nginx/mime.types;
}

location /static {
gzip_static on;
expires max;
#alias /www/py37/django_test/repo/.static_root;
#alias /www/django_sample/static;
# normally static folder is named as /static
alias webroot/static; # your Django project's static files - amend as required
#include /etc/nginx/mime.types;
Expand Down
10 changes: 5 additions & 5 deletions config/web-server/nginx/uwsgi/sample_nginx_https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.com.uwsgi_access.log main;
error_log /log/nginx/filename.com.uwsgi_error.log warn;

# Django media
location /media {
gzip_static on;
expires max;
#alias /www/py37/django_test/repo/media;
#alias /www/django_sample/media;
alias webroot/media; # your Django project's media files - amend as required
#include /etc/nginx/mime.types;
}

location /static {
gzip_static on;
expires max;
#alias /www/py37/django_test/repo/.static_root;
# normally static folder is named as /static
#alias /www/django_sample/static;
# normally static folder is named as /static
alias webroot/static; # your Django project's static files - amend as required
#include /etc/nginx/mime.types;
}
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/uwsgi/sample_nginx_proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ server {
listen portnumber;
server_name domain www.domain;

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.uwsgi_proxy_access.log main;
error_log /log/nginx/filename.uwsgi_proxy_error.log warn;
# Log Location. Can be anywhere. Make sure the nginx user defined in /etc/nginx/nginx.conf has r/w permissions

###
Expand Down
4 changes: 2 additions & 2 deletions config/web-server/nginx/uwsgi/sample_nginx_proxy_https.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ server {
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7

access_log /log/nginx/filename.access.log main;
error_log /log/nginx/filename.error.log warn;
access_log /log/nginx/filename.com.uwsgi_access.log main;
error_log /log/nginx/filename.com.uwsgi_error.log warn;

# # Allow Lets Encrypt Domain Validation Program
# location ^~ /.well-known/acme-challenge/ {
Expand Down
4 changes: 2 additions & 2 deletions docker/gunicorn/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

cd /www/py37/django_test/repo
cd /www/django_sample

requirements_file="requirements.txt"

Expand All @@ -9,7 +9,7 @@ if [ -f $requirements_file ]; then
pip install -r requirements.txt
fi

gunicorn --workers 4 --bind 0.0.0.0:8000 conf.wsgi:application --daemon --reload
gunicorn --workers 4 --bind 0.0.0.0:8000 django_sample.wsgi:application --daemon --reload

while true;
do
Expand Down
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit b942f86

Please sign in to comment.