论坛搭建
[root@server1 ~]# yum install unzip -y
[root@server1 ~]# unzip Discuz_X3.2_SC_UTF8.zip -d /usr/local/lnmp/nginx/html/
//解压并指定到发布目录
[root@server1 ~]# cd /usr/local/lnmp/nginx/html/
[root@server1 html]# ls
50x.html index.html index.php readme upload utility
[root@server1 html]# mv upload/ bbs //修改名称
权限不够,加权限
[root@server1 html]# cd bbs/
[root@server1 bbs]# ls
admin.php connect.php forum.php member.php search.php uc_server
api cp.php group.php misc.php source userapp.php
api.php crossdomain.xml home.php plugin.php static
archiver data index.php portal.php template
config favicon.ico install robots.txt uc_client
[root@server1 bbs]# chmod 777 config data/ uc_server/ uc_client/ -R
提示找不到目录
[root@server1 bbs]# cd
[root@server1 ~]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# cat /etc/my.cnf
For advice on how to change settings please see
http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
*** DO NOT EDIT THIS FILE. Its a template which will be copied to the
*** default location during install, and will be replaced if you
*** upgrade to a newer version of MySQL.
[mysqld]
Remove leading # and set to the amount of RAM for the most important data
cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
Remove leading # to turn on a very important data integrity option: logging
changes to the binary log between backups.
log_bin
These are commonly set, remove the # and set as required.
basedir = /usr/local/lnmp/mysql
datadir = /usr/local/lnmp/mysql/data
port = 3306
#server_id = …
// socket = /usr/local/lnmp/mysql/data/mysql.sock// mysql的链接地址
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
修改php的链接地址
[root@server1 etc]# vim php.ini
[root@server1 etc]# /etc/init.d/php-fpm reload //重启服务
Reload service php-fpm done
权限受限
[root@server1 etc]# cd /usr/local/lnmp/mysql/
[root@server1 mysql]# ll
total 60
drwxr-xr-x 2 root root 4096 Aug 5 10:05 bin
-rw-r–r-- 1 root root 17987 Nov 28 2016 COPYING
//drwxr-x— 5 mysql root 4096 Aug 5 11:04 data// 修改权限
drwxr-xr-x 2 root root 4096 Aug 5 10:05 docs
drwxr-xr-x 3 root root 4096 Aug 5 10:05 include
drwxr-xr-x 4 root root 4096 Aug 5 10:05 lib
drwxr-xr-x 4 root root 4096 Aug 5 10:05 man
drwxr-xr-x 10 root root 4096 Aug 5 10:05 mysql-test
-rw-r–r-- 1 root root 2478 Nov 28 2016 README
drwxr-xr-x 28 root root 4096 Aug 5 10:05 share
drwxr-xr-x 2 root root 4096 Aug 5 10:36 support-files
[root@server1 mysql]# chmod 755 data
[root@server1 mysql]# cd
[root@server1 ~]# cd /usr/local/lnmp/nginx/html/bbs/
[root@server1 bbs]# cd install/
[root@server1 install]# rm f index.php
rm: remove regular file `index.php’? y
Mecphp模块缓存
[root@server1 ~]# tar zxf memcache-2.2.5.tgz
[root@server1 ~]# ls
Discuz_X3.2_SC_UTF8.zip nginx-1.10.1
gd-devel-2.0.35-11.el6.x86_64.rpm nginx-1.10.1.tar.gz
libmcrypt-2.5.8-9.el6.x86_64.rpm nginx-sticky-module-ng.tar.gz
libmcrypt-devel-2.5.8-9.el6.x86_64.rpm package.xml
memcache-2.2.5 php-5.6.35
memcache-2.2.5.tgz php-5.6.35.tar.bz2
mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar re2c-0.13.5-1.el6.x86_64.rpm
mysql.tgz
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# ls
config9.m4 memcache.c memcache_queue.h
config.m4 memcache_consistent_hash.c memcache_session.c
config.w32 memcache.dsp memcache_standard_hash.c
CREDITS memcache.php php_memcache.h
example.php memcache_queue.c README
[root@server1 memcache-2.2.5]# phpzie
-bash: phpzie: command not found
[root@server1 memcache-2.2.5]# cd /usr/local/lnmp/php/bin/
[root@server1 bin]# ls
pear peardev pecl phar phar.phar php php-cgi php-config phpize
[root@server1 bin]# cd /usr/local/lnmp/php/sbin/
[root@server1 sbin]# ls
php-fpm
[root@server1 sbin]# cd
[root@server1 ~]# vim .bash_profile
[root@server1 ~]# source .bash_profile
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@server1 memcache-2.2.5]# ./configure
[root@server1 memcache-2.2.5]# make && make install
[root@server1 memcache-2.2.5]# cd /usr/local/lnmp/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@server1 no-debug-non-zts-20131226]# ls
memcache.so opcache.a opcache.so
[root@server1 no-debug-non-zts-20131226]# php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
[root@server1 no-debug-non-zts-20131226]# php -m | grep memcache
[root@server1 no-debug-non-zts-20131226]# cd
[root@server1 ~]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php.ini
[root@server1 etc]# vim php.ini
[root@server1 etc]# /etc/init.d/php-fpm reload
Reload service php-fpm done
[root@server1 etc]# php -m | grep memcache
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lnmp/php/lib/php/extensions/no-debug-non-zts-20131226/msql.so’ - /usr/local/lnmp/php/lib/php/extensions/no-debug-non-zts-20131226/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[root@server1 etc]# yum install memcached -y
[root@server1 etc]# /etc/init.d/memcached start
Starting memcached: [ OK ]
[root@server1 etc]# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 18971/memcached
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 16242/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 910/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 986/master
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 18944/php-fpm
tcp 0 0 172.25.2.1:55235 172.25.2.250:80 TIME_WAIT -
tcp 0 0 172.25.2.1:22 172.25.2.250:45790 ESTABLISHED 1036/sshd
tcp 0 0 172.25.2.1:22 172.25.2.250:45818 ESTABLISHED 7198/sshd
tcp 0 0 :::11211 ::? LISTEN 18971/memcached
tcp 0 0 :::22 ::? LISTEN 910/sshd
tcp 0 0 ::1:25 ::? LISTEN 986/master
tcp 0 0 :::3306 ::? LISTEN 1212/mysqld
[root@server1 etc]# cd
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# cp memcache.php example.php /usr/local/lnmp/nginx/html/
[root@server1 memcache-2.2.5]# rpm -q memcached
memcached-1.4.4-3.el6.x86_64
[root@server1 memcache-2.2.5]# netstat -antlp | grep :11211
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 18971/memcached
tcp 0 0 :::11211 ::? LISTEN 18971/memcached
[root@server1 memcache-2.2.5]# cd /usr/local/lnmp/nginx/html/
[root@server1 html]# ls
50x.html example.php index.php readme
bbs index.html memcache.php utility
[root@server1 html]# vim memcache.php
[root@server1 html]# pwd
/usr/local/lnmp/nginx/html
[root@server1 html]# ls
50x.html example.php index.php readme
bbs index.html memcache.php utility
[root@server1 html]# vim index.php
[root@server1 html]# nginx -s reload
[root@server1 html]# vim example.php
[root@server1 html]# nginx -s reload
[root@server1 html]# nginx -s stop
root@server1 ~]# tar zxf openresty-1.13.6.1.tar.gz
[root@server1 ~]# cd openresty-1.13.6.1
[root@server1 openresty-1.13.6.1]# ./configure --prefix=/usr/local/lnmp/openresty --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx --with-threads --with-file-aio
[root@server1 openresty-1.13.6.1]# gmake && gmake install
[root@server1 ~]# cd /usr/local/lnmp/openresty/nginx/conf/
[root@server1 conf]# vim nginx.conf
[root@server1 conf]# /usr/local/lnmp/openresty/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/lnmp/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/lnmp/openresty/nginx/conf/nginx.conf test is successful
[root@server1 conf]# /usr/local/lnmp/openresty/nginx/sbin/nginx
[root@server1 conf]# cd
[root@server1 ~]# cd /usr/local/lnmp/openresty/nginx/html/
[root@server1 html]# cp /usr/local/lnmp/nginx/html/example.php .
[root@server1 html]# cp /usr/local/lnmp/nginx/html/index.php .
[root@foundation2 kiosk]# ab -c 10 -n 1000 http://172.25.2.1/example.php
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 172.25.2.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: openresty/1.13.6.1
Server Hostname: 172.25.2.1
Server Port: 80
Document Path: /example.php
Document Length: 0 bytes
Concurrency Level: 10
Time taken for tests: 0.620 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Non-2xx responses: 1000
Total transferred: 188000 bytes
HTML transferred: 0 bytes
Requests per second: 1613.20 [#/sec] (mean)
Time per request: 6.199 [ms] (mean)
Time per request: 0.620 [ms] (mean, across all concurrent requests)
Transfer rate: 296.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 4
Processing: 1 6 0.7 6 9
Waiting: 1 6 0.7 6 9
Total: 1 6 0.6 6 9
Percentage of the requests served within a certain time (ms)
50% 6
66% 6
75% 6
80% 7
90% 7
95% 7
98% 8
99% 8
100% 9 (longest request)