树莓派-部署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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM