安装nginx和uwsgi
apt-get install nginx pip install uwsgi
配置文件:
blog-nginx.conf:
server { listen 80; server_name MY_SERVER_NAME; access_log /var/log/nginx/blog.access.log; error_log /var/log/nginx/blog.error.log; location /static { alias /srv/blog/ashin/static; } location / { root /srv/blog; uwsgi_pass unix:///tmp/uwsgi.sock; include uwsgi_params; } }
blog-uwsgi.ini:
[uwsgi] uid=www-data gid=www-data socket=/tmp/uwsgi.sock master=True chdir=/srv/blog module=ashin.wsgi:application chmod-socket=666 pidfile=/tmp/blog.pid virtualenv = /srv/blog/venv touch-reload = /srv/blog/requirements.txt max-requests=5000 memory-report=true enable-threads=true daemonize=/tmp/blog.log
将blog-nginx.conf
复制到nginx配置目录
cp blog.conf /etc/nginx/sites-enabled/blog.conf ln -s /etc/nginx/sites-enabled/blog.conf /etc/nginx/sites-available/blog.conf
用virtualenv安装站点python依赖到uwsgi配置中写的路径后运行:
nginx -s reload uwsgi --ini blog-uwsgi.ini
若用sqlite3做数据库需要递归修改目录权限,否则无法打开数据库文件
没有成功可以查看/tmp/blog.log日志信息,Ps:这里使用的uwsgi是通过pip安装,如果是通过apt-get安装可能不适用
网友116.*.*.23[火星]2021-01-24 07:52
网友216.*.*.226[Seattle]2021-01-24 07:12
网友54.*.*.162[法国]2021-01-24 06:31
网友64.*.*.176[火星]2021-01-24 06:30
发表评论
亲~ 评论内容是必须的哟! o(∩_∩)o
昵称
邮箱
主页
评论