请注意,本文编写于 3313 天前,最后修改于 2237 天前,其中某些信息可能已经过时。
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
opkg install mysql-server
opkg install nginx spawn-fcgi zoneinfo-core zoneinfo-asia
opkg install shadow-groupadd shadow-useradd
groupadd www useradd -g www www
chown -R www:www /media/mmcblk0p5/web
修改/opt/etc/my.cnf
datadir = /media/mmcblk0p5/data/mysql/
tmpdir = /media/mmcblk0p5/data/tmp/
创建数据库文件夹
mkdir -p /media/mmcblk0p5/data /media/mmcblk0p5/data/mysql /media/mmcblk0p5/data/tmp
创建默认的数据库
/opt/bin/mysql_install_db --force
启动mysql
/opt/bin/mysqld
创建mysql密码
/opt/bin/mysqladmin -u root password 123456
登录数据库
mysql -u root -p
创建数据库
create database abcd
\g
查看数据库
show databases
\g
修改/opt/etc/nginx/nginx.conf
user root root;
worker_processes 1;
error_log /opt/var/log/nginx_error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /opt/var/run/nginx.pid;
events {
use epoll;
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;
access_log off;
include vhost.conf;
}
添加/opt/etc/nginx/vhost.conf
server {
listen 81;
server_name 192.168.1.111;
root /media/mmcblk0p5/web;
index index.html index.htm index.php default.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~* ^.+\.php(\/.*)*$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /media/mmcblk0p5/web/$document_root$fastcgi_script_name;
include fastcgi_params;
}
}
修改/opt/etc/php.ini
short_open_tag = on
doc_root = "/media/mmcblk0p5/web"
upload_tmp_dir = "/media/mmcblk0p5/web/tmp"
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 = /opt/var/run/mysqld.sock
注意几个opt/tmp路径
启动spawn-fcgi nginx必须用root权限
/opt/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 2 -f /opt/bin/php-cgi
启动nginx
nginx
1 条评论
表示全部看不懂,但手头有空闲赚钱宝一代想好好利用一下