So,開始之前你需要什么? 關(guān)于openwrt OpenWrt的被描述為一個(gè)嵌入式設(shè)備的Linux發(fā)行版,而不是試圖建立一個(gè)單一的,靜態(tài)的固件,OpenWrt的包管理提供了一個(gè)完全可寫的文件系統(tǒng),從應(yīng)用程序供應(yīng)商提供的選擇和配置,并允許您自定義的設(shè)備,以適應(yīng)任何應(yīng)用程
OpenWrt的被描述為一個(gè)嵌入式設(shè)備的Linux發(fā)行版,而不是試圖建立一個(gè)單一的,靜態(tài)的固件,OpenWrt的包管理提供了一個(gè)完全可寫的文件系統(tǒng),從應(yīng)用程序供應(yīng)商提供的選擇和配置,并允許您自定義的設(shè)備,以適應(yīng)任何應(yīng)用程序通過使用包。對(duì)于開發(fā)人員,OpenWrt的是框架來構(gòu)建應(yīng)用程序,而無需建立一個(gè)完整的固件左右;對(duì)于用戶來說,這意味著完全定制的能力,從來沒有預(yù)想的方式使用該設(shè)備。
所以,你需要買上一個(gè)路由器,或者用自帶的,至于各種教程就網(wǎng)上找吧。如果不知道Openwrt是什么請(qǐng)谷歌,如果你的路由器不能上網(wǎng),帶有無線的話,試著用connectify共享出你的網(wǎng)絡(luò)。
(Ps:需要有Linux基礎(chǔ)才會(huì)各種沒有壓力,power by Phodal.com)
參考這個(gè)貼子:http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=5983,擴(kuò)展你的系統(tǒng)到U盤上。
opkg update opkg install kmod-usb-ohci kmod-usb2 kmod-fs-ext3 opkg install kmod-usb-storage reboot mount /dev/sda1 /mnt mkdir /tmp/root mount -o bind / /tmp/root cp /tmp/root/* /mnt -a umount /tmp/root umount /mnt echo Booted from internal rom >> /etc/banner opkg update opkg install block-extroot
echo option force_space >> /etc/opkg.conf reboot
當(dāng)然了,如果你的路由器帶有支持extroot功能的話,直接就能用。如我的
總之是為了保證有足夠的空間來安裝這些。
需要安裝libffi,python-mini,python。libffi以及python-mini需要安裝在python之前
wget -c http://downloads.openwrt.org.cn/backfire/10.03.1/brcm63xx/packages/libffi_3.0.9-1_brcm63xx.ipk wget -c http://downloads.openwrt.org.cn/backfire/10.03.1/brcm63xx/packages/python-mini_2.6.4-3_brcm63xx.ipk wget -c http://downloads.openwrt.org.cn/backfire/10.03.1/brcm63xx/packages/python_2.6.4-3_brcm63xx.ipk
opkg install libffi*.ipk opkg install python-mini*.ipk opkg install python_2*.ipk
http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
安裝easy_install
sh setuptools-0.6c11-py2.6.egg
easy_install pip
pip install django
創(chuàng)建一個(gè)django項(xiàng)目,比如Onrt
django-admin.py startproject Onrt
(powered by Phodal.com)
安裝sqlite以及l(fā)ighttpd,如果不能直接安裝請(qǐng)使用wget
opkg install lighttpd opkg install libsqlite2 opkg install libsqlite3 opkg install lighttpd-mod-access opkg install lighttpd-mod-alias opkg install lighttpd-mod-cgi opkg install lighttpd-mod-fastcgi opkg install lighttpd-mod-rewrite opkg install lighttpd-mod-redirect opkg install sqlite2-cli
opkg install nginx opkg install fastcgi
/etc/init.d/nginx start
修改nginx.conf。位于/etc/nginx/nginx.conf
user nobody nogroup; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; events { worker_connections 1024; } http { include mime.types; index index.php index.html index.htm; default_type text/html; sendfile on; keepalive_timeout 65; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; server { listen 88; server_name YOUR_SERVER; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 32k; fastcgi_buffers 4 32k; fastcgi_busy_buffers_size 32k; fastcgi_temp_file_write_size 32k; client_body_timeout 10; client_header_timeout 10; send_timeout 60; output_buffers 1 32k; postpone_output 1460; root /root/Onrt; location /static/ { # STATIC_URL alias /root/Onrt; # STATIC_ROOT expires 30d; } location /media/ { # MEDIA_URL alias /root/Onrt; # MEDIA_ROOT expires 30d; } location / { include fastcgi_params; fastcgi_pass 127.0.0.1:1259; } #location ~ \.php$ { # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # include fastcgi_params; # # if (-f $request_filename) { # # Only throw it at PHP-FPM if the file exists (prevents some PHP exploits) # fastcgi_pass 127.0.0.1:1026; # The upstream determined above # } #} } }
python /root/Onrt/manage.py runfcgi host=127.0.0.1 port=1259;
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com