openwrt路由搭建php教程,路由搭建博客教程及博客选择本帖最后由 jnussl 于 2014-4-25 01:21 编辑
接触OP也有很长的时间了,总结下在路由上搭建⽹站的步骤吧。博客演⽰地址: www.damuzi ⼤家可以参考下速度,ADSL上传限制是512Kb.
针对WZR-AG300H路由,刷OpenWrt 12.09版本
说下简单步骤吧
先刷OPENWRT系统,
,在Network->Interfaces—wan->General Setup中设置成PPPoE,填写ADSL⽤户名和密码,保存提交就可以上⽹了
putty登录
opkg update
opkg install luci-i18n-chinese kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 kmod-usb-storage ntfs-3g kmod-fs-vfat block-mount usbutils fdisk
在管理页⾯ 系统—挂载点中设置⾃动挂载U盘
安装HTTP服务
opkg install lighttpd lighttpd-mod-fastcgi lighttpd-mod-cgi lighttpd-mod-rewrite lighttpd-mod-redirect lighttpd-mod-access lighttpd-mod-alias
opkg install php5 php5-mod-gd php5-mod-session php5-mod-pdo php5-mod-xml php5-mod-pdo-mysql php5-mod-mysql php5-fastcgi php5-mod-iconv php5-mod-simplexml
opkg install php5-mod-mbstring  php5-mod-mcrypt libmcrypt php5-mod-ctype php5-mod-tokenizer php5-mod-json php5-mod-sockets
opkg install mysql-server  libncurses php5-mod-curl lighttpd-mod-evasive libsqlite3 php5-mod-mysqli
mkdir /mnt/sda1/www
mkdir /mnt/sda1/tmp
chmod 777 /mnt/sda1/www
chmod 777 /mnt/sda1/tmp
创建数据库⽂件夹
mkdir /mnt/sda1/data
mkdir /mnt/sda1/data/mysql
mkdir /mnt/sda1/data/tmp
chmod 777 /mnt/sda1/data
chmod 777 /mnt/sda1/data/mysql
chmod 777 /mnt/sda1/data/tmp
vi /etc/myf
datadir  =/mnt/sda1/data/mysql/
tmpdir  =/mnt/sda1/data/tmp/
创建默认的数据库
/usr/bin/mysql_install_db --force
可能会报错,没有报错最好,如果有报错,那就把附件⾥的数据库⽂件复制进去,替换那些⽣成的数据库⽂件就好了,之后再输⼊如下命令就可以正常启动mysql了
/etc/init.d/mysqld start
也可以输⼊关闭mysql,只是现在千万别输⼊这个命令关闭mysql
/etc/init.d/mysqld stop
输⼊如下命令创建mysql的密码
/usr/bin/mysqladmin -u root password ******
登陆数据库
mysql -u root -p
查看当前可⽤数据库
show databases
\g
quit
php.ini⽂件中必须填写[MYSQL]部分,否则在安装博客时会提⽰⽆法建⽴MYSQL/MYSQLI链接(这也是以往的教程忽略的地⽅啊)
extension=mysqli.so
mysql.default_port =3306
mysql.default_socket =/var/run/mysqld.sock
mysqli.default_socket =/var/run/mysqld.sock
6.安装动态域名
opkg install ddns-scripts luci-app-ddns
登录LUCI修改3322动态域名
******.
******
******
php mysql教程视频
"mod_alias",
"mod_access",
"mod_evasive",
"mod_rewrite",
"mod_redirect",
"mod_fastcgi"
)
server.document-root = "/mnt/sda1/www/"
server.port = 82
index-file.names = ( "index.php", "index.html","default.html", "index.htm", "default.htm" )
fastcgi.server    = ( ".php" =>
( "localhost" =>
(
"socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-fcgi",
"max-procs" => 2,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "2",
"PHP_FCGI_MAX_REQUESTS" => "500"
)
)
)
)
evasive.max-conns-per-ip = 6
php.ini⽂件修改
short_open_tag = On
error_log = /var/log/php_errors.log
file_uploads = On
upload_tmp_dir = "/tmp"
upload_max_filesize = 8M
max_file_uploads = 20
doc_root = "/mnt/sda1/www"
extension=curl.so
extension=mbstring.so
extension=mcrypt.so
extension=pdo.so
extension=pdo-mysql.so
extension=mysql.so
extension=gd.so
extension=session.so
extension=sockets.so
extension=tokenizer.so
extension=xml.so
extension=xmlreader.so
extension=xmlwriter.so
date.timezone = prc
mysql.default_socket = /var/run/mysqld.sock session.auto_start = 1
mysql.default_port =3306
mysql.default_socket =/var/run/mysqld.sock 以上步骤完成后就可以上传博客安装使⽤了

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。