用迅雷赚钱宝pro建网站

作者: E星期五 分类: 网络备忘 发布时间: 2016-05-26 15:43 ė 1360 次浏览 6 没有评论

这篇文章在收藏夹有一段时间了,原本不想转过来,但最近迅雷方面封Root的力度加大了,万一源站关了哪儿找教程去。
需要Root登入,如何root现在是个难题。

      一直想在openwrt 上搭建动态网站开发环境,刚好手上有坑钱宝性能还过得去。于是苦熬了N个晚上研究大神的帖子,经历无数次痛苦的失败调测。终于成功搭起了FTP服务器及 PHP、 Mysql 、运行环境并安装了PPPOE拨号配置DDNS。晒一下探针运行的截图,和运行时CPU的数据、top 数据。教程尽快给大家奉上!
1代、pro 都成功架了网站。希望和更多玩家交流。
====================================================================================================
关于本教程重要说明:
1、玩这个最好有点Linux 基础,能根据操作过程反馈信息判断问题,并能解决问题。本人的每次操作都可能会出现不同的问题。
2、用本教程架网站的前提条件:1、有设备root权限  2、安装并配置好qnapware  3、装好FTP服务器 (3者缺1不可,2、3项本论坛都已出教程,如何root 请百度搜一下)
3、硬盘建议分成两个分区,一个用于挖矿,一个用于存放网站数据。可以在windows下分好,再挂上。
4、本教程(红色字)为注释,不要输入;绿色字体是操作命令。
5、为保证操作命令和代码的准确,我写的教程都是真实操作记录整理,如有错误欢迎指正。
6、请尊重别人的劳动成果转载请务必注明出处:http://ovo.f3322.net:88/bbs
==============================================================================
第一部分—- 安装Mysql
Mysql 是Openwrt 上架动态网站的理想数据库。如果完成这部份那恭喜你,已经成功一半了。

————————————————————————————————————————————————————————————————————————————————————–
#
#/opt/bin/opkg update (更新安装包)
Downloading http://qnapware.zyxmon.org/binaries-armv7/Packages.gz.
Updated list of available packages in /opt/var/opkg-lists/packages.
#
# cd /opt (进入安装目录 /opt )
#
# /opt/bin/opkg install mysql-server ( 安装Mysql )
Installing mysql-server (5.1.73-2) to root…
Downloading http://qnapware.zyxmon.org/binaries-armv7/mysql-server_5.1.73-2_armv7soft.ipk.
Installing libncursesw (5.9-2) to root…
Downloading http://qnapware.zyxmon.org/binaries-armv7/libncursesw_5.9-2_armv7soft.ipk.
Installing libreadline (6.3-1) to root…
Downloading http://qnapware.zyxmon.org/binaries-armv7/libreadline_6.3-1_armv7soft.ipk.
Configuring libncursesw.
Configuring libreadline.
Configuring mysql-server.

#
#mkdir /media/sda2/data ( 建立数据库工作目录。)

#mkdir /media/sda2/data/mysql ( 建立数据库目录,目录可自定义,后面配置改好即可 。)
#mkdir /media/sda2/data/tmp ( 建立数据库临时文件目录 ,目录可自定义,后面配置改好即可 。)
#
#vi /opt/etc/my.cnf( 编辑配置文件 )
#
———————————————————————————————————————
参考配置文件 my.cnf
———————————————————————————————————————
[client]
port  = 3306
socket  = /opt/var/run/mysqld.sock
[mysqld]
user  = root
socket  = /opt/var/run/mysqld.sock
port  = 3306
basedir  = /opt
############ Don’t put this on the NAND #############
# Figure out where you are going to put the databases
# And run mysql_install_db –force
datadir  = /media/sda2/data/mysql ( 改成你数据库实际绝对路径,目录请提前建好。 )
######### This should also not go on the NAND #######
tmpdir  = /media/sda2/data/tmp/( 改成你数据库临时文件实际绝对路径, 目录请提前建好。
skip-external-locking
bind-address  = 127.0.0.1
# Fine Tuning
key_buffer  = 16M
max_allowed_packet = 16M
thread_stack  = 192K
thread_cache_size       = 8
# Here you can see queries with especially long duration
#log_slow_queries = /opt/var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
# The following can be used as easy to replay backup logs or for replication.
#server-id  = 1
#log_bin   = /opt/var/log/mysql/mysql-bin.log
#expire_logs_days = 10
#max_binlog_size         = 100M
#binlog_do_db  = include_database_name
#binlog_ignore_db = include_database_name
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer  = 16M

———————————————————————————————————————
#
# /opt/bin/mysql_install_db  –force( 初始化数据库)
Installing MySQL system tables…
OK
Filling help tables…
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/bin/mysqladmin -u root password ‘new-password’
/opt/bin/mysqladmin -u root -h XL_MINER_0125 password ‘new-password’
Alternatively you can run:
/opt/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt ; /opt/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/scripts/mysqlbug script!
#
# /opt/etc/init.d/S70mysqld start
Starting mysqld…              done.  ( 数据库启动成功 !)
#
# /opt/bin/mysqladmin -u root password ‘12345678’ ( 设置你的数据库密码为:12345678 建议设更复杂密码。 )
#
# /opt/bin/mysql -u root -p
Enter password:  ( 输入你的数据库密码为:12345678 )
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
mysql> ( 如果看到这行,那么恭喜你,已经成功一半了!!!可以先休息一下了。)
mysql> Ctrl-C — exit!
Aborted

===========================================================
第二部分—- 安装Nginx WEB 服务器(已复核,并出视频!)
——————————————————————————————————————————————————–

#

#mkdir /media/sda1/web建立网站工作目录,目录可自定义,后面配置改好即可
#mkdir /media/sda1/web/tmp ( 建立网站临时文件目录 ,目录可自定义,后面配置改好即可
#
# /opt/bin/opkg install nginx 安装Nginx
Installing nginx (1.4.7-4) to root…
Downloading http://qnapware.zyxmon.org/binaries-armv7/nginx_1.4.7-4_armv7soft.ipk.
Configuring nginx.
#  
# vi /opt/etc/nginx/nginx.conf (编辑配置文件,进入后按 “ i ” 键进入编辑模式,编辑完成后按 “esc” 键退出并输入 “ :wq ” 保存配置)
#  
——————————————————————————————-
参考nginx.conf配置
———————————————————————————————————————————

user root;

worker_processes  1;
error_log /opt/var/log/nginx/error.log;
#error_log /opt/var/log/nginx/error.log notice;
#error_log /opt/var/log/nginx/error.log info;
pid       /opt/var/run/nginx.pid;
events {
   use epoll;
   worker_connections  64;
}
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 /opt/var/log/nginx/access.log;
   sendfile        on;
   #tcp_nopush     on;
   #keepalive_timeout  0;

   keepalive_timeout  65;

   gzip  on;
   access_log   off;
   include       vhost.conf;
}
——————————————————————————————————————————–
#
# vi /opt/etc/nginx/vhost.conf (编辑配置文件,进入后按 “ i ” 键进入编辑模式,编辑完成后按 “esc” 键退出并输入 “ :wq ” 保存配置(也可以在FTP软件编辑))
#

———————————————————————————————————————————

添加vhost.conf 文件( 参考配置 )
———————————————————————————————————————————
server {
       listen       88; 监听端口,如果当地宽带运营商屏蔽了80端口请改为其他端口
       server_name  localhost;
       root  /media/sda1/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/sda1/web/$fastcgi_script_name;
       include        fastcgi_params;

    }

}
#
#/opt/etc/init.d/S80nginx start
Starting nginx…              done.

===========================================================
第三部分—- 安装PHP 解析组件
(已复核!)
———————————————————————————————————————————————————
#
# /opt/bin/opkg install php5 php5-mod-gd php5-mod-session php5-mod-pdo

# /opt/bin/opkg install php5-mod-pdo-mysql php5-mod-mysql php5-mod-mcrypt
# /opt/bin/opkg install php5-mod-mbstring php5-fastcgi php5-cgi php5-mod-xml
# /opt/bin/opkg install php5-mod-ctype php5-mod-curl php5-mod-exif php5-mod-ftp
# /opt/bin/opkg install php5-mod-iconv php5-mod-json php5-mod-sockets
# /opt/bin/opkg install php5-mod-sqlite3 php5-mod-tokenizer php5-mod-zip
#/opt/bin/opkg install nginx spawn-fcgi
安装PHP5及支持组件
Installing opkg(9c97d5ecd795709c8584e972bfdf3aee3a5b846d-8) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 6d-8_armv7soft.ipk.
Unknown package ‘install’.
ackage php5 (5.6.13-1) installed in root isup to date.
Installing php5-mod-gd (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Package php5-mod-session (5.6.13-1) installedin root is up to date.
Installing php5-mod-pdo (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Installing php5-mod-pdo-mysql (5.6.13-1) toroot…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Package php5-mod-mysql (5.6.13-1) installed inroot is up to date.
Installing php5-mod-mcrypt (5.6.13-1) toroot…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Package php5-mod-mbstring (5.6.13-1) installedin root is up to date.
Package php5-fastcgi (5.6.13-1) installed inroot is up to date.
Package php5-cgi (5.6.13-1) installed in rootis up to date.
Installing php5-mod-xml (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Package php5-mod-ctype (5.6.13-1) installed inroot is up to date.
Installing php5-mod-curl (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Installing php5-mod-exif (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Installing php5-mod-ftp (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Installing php5-mod-iconv (5.6.13-1) toroot…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Package php5-mod-json (5.6.13-1) installed inroot is up to date.
Installing php5-mod-sockets (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Installing php5-mod-sqlite3 (5.6.13-1) toroot…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Packagephp5-mod-tokenizer (5.6.13-1) installed in root is up to date.
Installing php5-mod-zip (5.6.13-1) to root…
Downloadinghttp://qnapware.zyxmon.org/binar … 13-1_armv7soft.ipk.
Configuring opkg.
Configuring php5-mod-iconv.
Configuring php5-mod-sqlite3.
Configuring php5-mod-xml.
Configuring php5-mod-zip.
Configuring php5-mod-ftp.
Configuring php5-mod-mcrypt.
Configuring php5-mod-pdo.
Configuring php5-mod-curl.
Configuring php5-mod-sockets.
Configuring php5-mod-gd.
onfiguringphp5-mod-exif.
Configuring php5-mod-pdo-mysql.
Collected errors:
*opkg_install_cmd: Cannot install package install.
#
#vi /opt/etc/php.ini (编辑配置文件,进入后按 “ i ” 键进入编辑模式,编辑完成后按 “esc” 键退出并输入 “ :wq ” 保存配置)

#

————————————————————————————————————
参考php.ini配置
————————————————————————————————————

[PHP]
zend.ze1_compatibility_mode = Off
; Language Options
engine = On
short_open_tag = On
precision    =  12
y2k_compliance = On
output_buffering = Off
;output_handler =
zlib.output_compression = Off
;zlib.output_compression_level = -1
;zlib.output_handler =
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
;open_basedir =
disable_functions =
disable_classes =
; Colors for Syntax Highlighting mode.  Anything that’s acceptable in
; <span style=”color: ???????”> would work.
;highlight.string  = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg      = #FFFFFF
;highlight.default = #0000BB
;highlight.html    = #000000
;ignore_user_abort = On
;realpath_cache_size = 16k
;realpath_cache_ttl = 120
; Miscellaneous
expose_php = On
; Resource Limits
max_execution_time = 30       ;Maximum execution time of each script, in seconds.
max_input_time = 60       ;Maximum amount of time each script may spend parsing request data.
;max_input_nesting_level = 64
memory_limit = 8M          ;Maximum amount of memory a script may consume.
; Error handling and logging
; Error Level Constants:
; E_ALL             – Allerrors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR           – fatalrun-time errors
; E_RECOVERABLE_ERROR  -almost fatal run-time errors
; E_WARNING         – run-timewarnings (non-fatal errors)
; E_PARSE           -compile-time parse errors
; E_NOTICE          – run-timenotices (these are warnings which often result
;                     from abug in your code, but it’s possible that it was
;                    intentional (e.g., using an uninitialized variable and
;                     relyingon the fact it’s automatically initialized to an
;                     emptystring)
; E_STRICT                          -run-time notices, enable to have PHP suggest changes
;                     to yourcode which will ensure the best interoperability
;                     andforward compatibility of your code
; E_CORE_ERROR      – fatalerrors that occur during PHP’s initial startup
; E_CORE_WARNING    – warnings(non-fatal errors) that occur during PHP’s
;                     initialstartup
; E_COMPILE_ERROR   – fatalcompile-time errors
; E_COMPILE_WARNING – compile-time warnings (non-fatal errors)
; E_USER_ERROR      -user-generated error message
; E_USER_WARNING    -user-generated warning message
; E_USER_NOTICE     -user-generated notice message
; E_DEPRECATED      – warnabout code that will not work in future versions
;                     of PHP
; E_USER_DEPRECATED – user-generated deprecation warnings
;
; Common Values:
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices andcoding standards warnings.)
;   E_ALL & ~E_NOTICE |E_STRICT  (Show all errors, except fornotices)
;  E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
;   E_ALL | E_STRICT  (Show all errors, warnings and noticesincluding coding standards.)
; Default Value: E_ALL & ~E_NOTICE
error_reporting  =  E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
;report_zend_debug = 0
track_errors = Off
;html_errors = Off
;docref_root = “/phpmanual/”
;docref_ext = .html
;error_prepend_string = “<font color=#ff0000>”
;error_append_string = “</font>”
; Log errors to specified file.
;error_log = /opt/var/log/php_errors.log
; Log errors to syslog.
;error_log = syslog
; Data Handling
;arg_separator.output = “&”
;arg_separator.input = “;&”
variables_order = “EGPCS”
request_order = “GP”
register_globals = Off
register_long_arrays = Off
register_argc_argv = On
auto_globals_jit = On
post_max_size = 8M
;magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = “text/html”
;default_charset = “iso-8859-1”
;always_populate_raw_post_data = On
; Paths and Directories
; UNIX: “/path1:/path2”
;include_path = “.:/php/includes”
doc_root = “/media/sda1/web”
user_dir =
extension_dir = “/opt/lib/php”
enable_dl = On
;cgi.force_redirect = 1
;cgi.nph = 1
;cgi.redirect_status_env = ;
cgi.fix_pathinfo=1
;fastcgi.impersonate = 1;
;fastcgi.logging = 0
;cgi.rfc2616_headers = 0
; File Uploads
file_uploads = On
upload_tmp_dir = “/media/sda1/web/tmp”
upload_max_filesize = 2M
max_file_uploads = 20
; Fopen wrappers
allow_url_fopen = On
allow_url_include = Off
;from=”john@doe.com”
;user_agent=”PHP”
default_socket_timeout = 60
;auto_detect_line_endings = Off
; Dynamic Extensions
extension=ctype.so
extension=curl.so
;extension=dom.so
;extension=exif.so
;extension=ftp.so
extension=gd.so
;extension=gmp.so
;extension=hash.so
;extension=iconv.so
;extension=json.so
;extension=ldap.so
extension=mbstring.so
extension=mcrypt.so
extension=mysql.so
;extension=openssl.so
;extension=pcre.so
extension=pdo.so
extension=pdo-mysql.so
;extension=pdo-pgsql.so
;extension=pdo_sqlite.so
;extension=pgsql.so
extension=session.so
;extension=soap.so
extension=sockets.so
;extension=sqlite.so
;extension=sqlite3.so
extension=tokenizer.so
extension=xml.so
;extension=xmlreader.so
;extension=xmlwriter.so
; Module Settings
[APC]
apc.enabled = 1
apc.shm_segments = 1   ;The numberof shared memory segments to allocate for the compiler cache.
apc.shm_size = 4M ;The size ofeach shared memory segment.
[Date]
date.timezone = Asia/Shanghai
;date.default_latitude = 31.7667
;date.default_longitude = 35.2333
;date.sunrise_zenith = 90.583333
;date.sunset_zenith = 90.583333
[filter]
;filter.default = unsafe_raw
;filter.default_flags =
[iconv]
;iconv.input_encoding = ISO-8859-1
;iconv.internal_encoding = ISO-8859-1
;iconv.output_encoding = ISO-8859-1
[sqlite]
;sqlite.assoc_case = 0
[sqlite3]
;sqlite3.extension_dir =
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket = /opt/var/run/mysqld.sock
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Session]
session.save_handler = files
session.save_path = “/opt/tmp”
session.use_cookies = 1
;session.cookie_secure =
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = On
session.bug_compat_warn = On
session.referer_check =
session.entropy_length = 0
;session.entropy_file = /dev/urandom
session.entropy_file =
;session.entropy_length = 16
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags =”a=href,area=href,frame=src,input=src,form=,fieldset=”
[mbstring]
;mbstring.language = Japanese
;mbstring.internal_encoding = EUC-JP
;mbstring.http_input = auto
;mbstring.http_output = SJIS
;mbstring.encoding_translation = Off
;mbstring.detect_order = auto
;mbstring.substitute_character = none;
;mbstring.func_overload = 0
;mbstring.strict_detection = Off
;mbstring.http_output_conv_mimetype=
;mbstring.script_encoding=
[gd]
;gd.jpeg_ignore_warning = 0
[exif]
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel   = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel    =JIS
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir=”/opt/tmp”
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
;sysvshm.init_mem = 10000
[ldap]
ldap.max_links = -1
[mcrypt]
;mcrypt.algorithms_dir=
;mcrypt.modes_dir=
[opcache]
;opcache.memory_consumption=8                   ;8M is the allowed minimum
;opcache.interned_strings_buffer=1
opcache.max_accelerated_files=200      ;200 is the allowed minimum
;opcache.revalidate_freq=60
;opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
;opcache.log_verbosity_level=4

#

# /opt/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 2 -f /opt/bin/php-cgi 启动php-cgi ,必须先启动,才能启动Nginx

spawn-fcgi: child spawnedsuccessfully: PID: 26653 启动成功!)
# /opt/etc/init.d/S80nginx start (启动Nginx
Starting nginx…              done. Nginx 启动成功!)

参考配置文件下载:http://pan.baidu.com/s/1geaFt2F 密码:q1dc

本文出自E星期五的博客,转载时请注明出处及相应链接。

本文永久链接: https://exqw.com/archives/617.html

0

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Ɣ回顶部