$ vi app.py
---
app.run('0.0.0.0',5000,debug=True)
---
$ sudo -i
$ service nginx stop
$ service uwsgi stop
$ vi /etc/nginx/sites-available/default
---
server {
## listen 80 default_server;
## listen [::]:80 default_server ipv6only=on;
listen 5000;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
## server_name localhost;
server_name 0.0.0.0;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
##try_files $uri $uri/ =404;
try_files $uri @app;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location @app {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
}
}
---
$ vi /etc/uwsgi/apps-available/uwsgi.ini
---
[uwsgi]
chdir=/home/service/service_flask
chmod-socket=666
callable=app
module=app
socket=/tmp/uwsgi.sock
virtualenv=/home/service/service_flask
---
$ cd /home/service/service_flask
$ . bin/activate
$ service nginx restart
$ service uwsgi restart
$ uwsgi /etc/uwsgi/apps-available/uwsgi.ini
$ uwsgi --ini ./uwsgi.ini --py-autoreload 1 //소스변경 반영 옵션설정
$ uwsgi --ini /etc/uwsgi/apps-available/uwsgi.ini --py-autoreload 1
'Python' 카테고리의 다른 글
구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (2) (0) | 2018.05.06 |
---|---|
구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (1) (0) | 2018.05.04 |
heroku 설정 방법 (0) | 2018.03.07 |
python, stored-procedure, mysql, flask, run api (0) | 2018.03.02 |
ubuntu, supervisor+uwsgi+nginx+python3 (0) | 2018.02.27 |