$ 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

Posted by 앤비
,