Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2 local settings #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions deployment/README_deployment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ec2 local settings

#location

/etc/nginx/sites-available/written.conf

/etc/nginx/sites-enabled/

#command
$ sudo ln -s /etc/nginx/sites-available/written.conf /etc/nginx/sites-enabled/written.conf

29 changes: 29 additions & 0 deletions deployment/sites-available/written.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
server {
listen 80 default;
server_name _;

location / {
uwsgi_pass unix://home/ec2-user/written_uwsgi.sock;
include /home/ec2-user/team7-server/written/uwsgi_params;
# return 301 https://$server_name$request_uri;
}
}
#
#server {
# listen 443 ssl default;
# server_name shchoi.shop www.shchoi.shop;
#
# ssl_certificate /etc/letsencrypt/live/www.shchoi.shop/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/www.shchoi.shop/privkey.pem;
#
# error_page 497 https://$server_name$request_uri;
#
# location / {
# uwsgi_pass unix://home/ec2-user/written.sock;
# include /home/ec2-user/team7-server/written/uwsgi_params;
# }
#
# location /static/ {
# root /home/ec2-user/waffle-rookies-18.5-backend-2/waffle_backend;
# }
#}
1 change: 1 addition & 0 deletions deployment/sites-enabled/written.conf
17 changes: 17 additions & 0 deletions written/uwsgi_params
Original file line number Diff line number Diff line change
@@ -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;

9 changes: 7 additions & 2 deletions written/written/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
DEBUG = True
DEBUG_TOOLBAR = os.getenv('DEBUG_TOOLBAR') in ('true', 'True')

ALLOWED_HOSTS = []
ALLOWED_HOSTS = [
'13.125.159.22',
'localhost',
'127.0.0.1',

]

# Application definition

Expand Down Expand Up @@ -81,7 +86,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1',
'HOST': 'terraform-20201229022238060000000001.cm6tz6yvqwf5.ap-northeast-2.rds.amazonaws.com',#개인 로컬 컴퓨터는 127.0.0.1
'PORT': 3306,
'NAME': 'written_waffle',
'USER': 'written-waffle',
Expand Down
26 changes: 26 additions & 0 deletions written/written_uwsgi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/ec2-user/team7-server/written
# Django's wsgi file
module = written.wsgi:application
# the virtualenv (full path)
home = /home/ec2-user/.pyenv/versions/venv_written
virtualenv = /home/ec2-user/.pyenv/versions/venv_written
# the socket (use the full path to be safe
socket = /home/ec2-user/written_uwsgi.sock
chmod-socket = 666

# process-related settings
# master
master = true
enable-threads = true
pidfile = /tmp/written_uwsgi.pid

vacuum = true
daemonize = /home/ec2-user/written_uwsgi.log
lazy-apps = true

buffer-size = 65535
max-requests = 500