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