树莓派-部署apache服务器

1. 更新科大的源 vim /etc/apt/sources.list

1 deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ jessie main contrib non-free rpi
apt-get update && apt-get upgrade

2. 安装apache2

apt-get install apache2

3. 修改wsgi.py

vim mysite/wsgi.py

4. 修改网站的配置文件 

vim /etc/apache2/sites-available/mysite.conf

ServerName mysite.com
WSGIScriptAlias / /home/code/web/mysite/mysite/wsgi.py


# Default Web Document root directory path
DocumentRoot /home/code/web/mysite


# Directory default attribute
<Directory /home/code/web/mysite>
Order allow,deny
Allow from all
</Directory>


# web static documents directory path
Alias /static /home/code/web/mysite/static


# Directory default attribute
<Directory /home/code/web/mysite/static>
Order allow,deny
Allow from all
</Directory>

5. 激活网站配置

vim mysite/settings.py

debug = False

vim mysite/wsgi.py

a2ensite mysite.conf

service apache2 reload 

出现错误  Invalid command 'WSGIScriptAlias'  解决方法

apt-get install libapache2-mod-wsgi
service apache2 restart
posted @ 2017-11-22 23:29  人微言轻1  阅读(2822)  评论(0编辑  收藏  举报