Rg100a-aa-openwrt+nginx+php+mysql

Source: Internet
Author: User
Tags mcrypt
RG100A-AA memory is 32m,flash to 16M, the clock is 300MHZ, small memory and low frequency, which determines the hardware conditions must be considered when setting up the server. The Lighttpd+php5+mysql standard tutorial says that the minimum memory is 64M, which clearly does not meet the existing hardware requirements. It is therefore necessary to look for a less expensive solution. You can refer to the http://www.right.com.cn/forum/thread-89216-1-1.html and http://tieba.baidu.com/p/2950214737 scenarios to try the configuration.

RG100A-AA equipped with Openwrt-dreambox 20120201 configuration nginx+php5+mysql steps:

1. Install related packages:

OPKG Update

opkg install php5 php5-mod-gd php5-mod-session php5-mod-pdo php5-mod-pdo-mysql php5-mod-mysql php5-mod-mcrypt Php5-mod-mbstring php5-fastcgi php5-cgi php5-mod-xml php5-mod-ctype php5-mod-curl php5-mod-exif php5-mod-ftp Php5-mod-iconv Php5-mod-json php5-mod-sockets php5-mod-sqlite3 php5-mod-tokenizer php5-mod-zip mysql-server nginx spawn-fcgi Zoneinfo-core Zoneinfo-asia Shadow-groupadd shadow-useradd

Problems encountered:

Unknown package ' Php5-mod-zip ', Unknown package ' Zoneinfo-core ', Unknown package ' Zoneinfo-asia ';

Collected Errors:

* Opkg_install_cmd:cannot Install package php5-mod-zip.

* Opkg_install_cmd:cannot Install package Zoneinfo-core.

* Opkg_install_cmd:cannot Install package Zoneinfo-asia.

This is because the source of the package has not been updated for a long time, you need to replace the package source and find a package source address that is the same as this processor model. In the/etc/opkg.conf

root@dreambox:/# vi/etc/opkg.conf

#src/GZ Packages Http://downloads.openwrt.org.cn/backfire/10.03.1/brcm63xx/packages

SRC/GZ Packages Http://downloads.openwrt.org/attitude_adjustment/12.09/brcm63xx/generic/packages

Dest Root/

Dest Ram/tmp

Lists_dir ext/var/opkg-lists

Option Overlay_root/overlay

The red font is the original package source address, the green font is the new source address, comment out the red configuration line, save and then re-execute opkg update;opkg install Php5-mod-zip zoneinfo-core zoneinfo-asia.

2. Establish Operation user

Mkdir/html

Groupadd www
Useradd-g www www
Chown-r www:www/html

3. Create a database folder

Mkdir-p/mnt/data/mnt/data/mysql/mnt/data/tmp

4. Create a default database

/usr/bin/mysql_install_db--force

Error: Installing MySQL system tables ...

/usr/bin/mysqld:can ' t resolve symbol ' Pthread_setschedprio '

Installation of system tables failed! Examine the logs in

/mnt/data/mysql/for more information.

This error is installed Mysql-server has a small bug, the introduction of this bug in Http://bugs.mysql.com/bug.php?id=4 2599 is described in detail.

Workaround:

(1) Uninstall mysql-server:opkg remove mysql-server;

(2) Replace the opkg source, cancel opkg.conf The first line of comments, comment on the second line.

(3) opkg update;opkg install Mysql-server

(4)/usr/bin/mysql_install_db--force

The following green font appears, indicating that the correct mysql-server has been installed.

Installing MySQL system tables ...

Ok

Filling Help Tables ...

Ok

(5) Starting mysqld:/etc/init.d/mysqld start

5, start MySQL, and create the root password, the password is set to 123, if really used, it is recommended to set the password of complex points:

/usr/bin/mysqladmin-u Root Password 123456

6. After connecting to MySQL, create the database:

MySQL > CREATE database discuz;

To view the currently available databases:

MySQL > show databases;

To view the database status:

MySQL > \s;

7, modify/etc/nginx/nginx.conf:

User www;

Worker_processes 1;

#error_log Logs/error.log;

#error_log Logs/error.log Notice;

#error_log Logs/error.log Info;

#pid Logs/nginx.pid;

Events {

Worker_connections 1024;

}

HTTP {

Include Mime.types;

Default_type Application/octet-stream;

#log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '

# ' $status $body _bytes_sent ' $http _referer '

# ' "$http _user_agent" "$http _x_forwarded_for" ';

#access_log Logs/access.log Main;

Sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

Keepalive_timeout 65;

#gzip on;

server {

Listen 88;

server_name localhost;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{

root HTML;

Index index.php index.html index.htm;

}

#error_page 404/404.html;

# REDIRECT Server error pages to the static page/50x.html

#

Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}

# Proxy The PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# Proxy_pass http://127.0.0.1;

#}

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

Location ~ \.php$ {

root HTML;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/html$fastcgi_script_name;

Include Fastcgi_params;

}

}

8, modification,/etc/php.ini

Short_open_tag = On

#doc_root = "/html"


Extension=ctype.so

Extension=curl.so

Extension=gd.so

Extension=mbstring.so

Extension=mcrypt.so

Extension=mysql.so

Extension=pdo.so

Extension=pdo_mysql.so

Extension=session.so

Extension=sockets.so

Extension=tokenizer.so

Extension=xml.so


[Date]

Date.timezone = Asia/shanghai


[MySQL]

Mysql.default_socket =/var/run/mysqld.sock

}

9, start the spawn-fcgi (if you need to run automatically, you can add commands to/etc/rc.local)

Usr/bin/spawn-fcgi-a 127.0.0.1-p 9000-c 2-f/usr/bin/php-cgi

10. Start Nginx

/etc/init.d/nginx start

11. Build PHP test file in/html directory:

#cd/html

#touch test.php

#chown www:www test.php

#vi test.php

Phpinfo ();

?>

You can see the configuration information of PHP by typing 192.168.1.11:88/test.php on the browser.

12, can download ya black probe to/html directory, ya black probe php file named tz.php, in the browser input 192.168.1.11:88/tz.php can see the configuration details of the Web server.

13. Establishment of DISCUZ Forum

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.