Centos7从LNMQ环境部署到phpwind9.0.2安装全过程(纯手打文字版)

— 本帖被 不靠谱贝贝 设置为精华(2018-03-12) —

话不多说,开始!
putty登入后,输入命令
yum search php

yum -y install php php-mcrypt php-bcmath php-cli php-common php-gd php-ldap php-mbstring php-mysqlnd php-pear php-pdo php-xml php-xmlrpc php-fpm memcached php-pecl-memcached

php -v

查看PHP版本显示:PHP 5.4.16 (cli) (built: Nov 15 2017 16:33:54)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

vi /etc/php.ini

(
改为:
date.timezone = PRC
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = PRC
)

vi /etc/nginx/nginx.conf

改为:
location / {
index index.php index.html index.htm;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

include /etc/nginx/rewrite.d/*.conf;

)这个括号不是内容

service nginx restart

vi /usr/share/nginx/html/php.php

内容:


service nginx restart
service php-fpm start
ie访问ip/php.php查看php的安装信息

vi /etc/php-fpm.d/www.conf

(改为:
user = nginx
group = nginx

systemctl restart php-fpm

yum -y install mariadb mariadb-server

systemctl start mariadb

systemctl enable mariadb

putty命令
mysql_secure_installation

以下是过程参考,要选择y/n和设置密码请注意:

[root@bbs ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 直接回车键
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 密码
Re-enter new password: 再输一遍密码
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

字符集设置,是utf8
vi /etc/my.cnf

在[mysqld]标签下添加

init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

在[client]中添加
default-character-set=utf8

vi /etc/my.cnf.d/client.cnf
(
在[mysql]中添加

default-character-set=utf8

)

全部配置完成,重启mariadb
systemctl restart mariadb

之后进入MariaDB查看字符集
mysql -u root -p
然后输入 password密码

show variables like "%character%";show variables like "%collation%";

看完后,
quit+回车退出mysql

phpwind伪静态设置(这个我是参考别人的)

mkdir /etc/nginx/rewrite.d
vim /etc/nginx/rewrite.d/phpwind.conf

内容为:

rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/thread.php?fid=$1 last;
rewrite ^(.*)u/([0-9]+)$ $1u.php?uid=$2 last;
rewrite ^(.*)/bbs.html$ $1/index.php?m=bbs last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
rewrite ^(.*)/archiver/fid-([0-9]+).html$ $1/simple/?f$2.html last;
rewrite ^(.*)/archiver/fid-([0-9]+)-page-([0-9]+).html$ $1/simple/?f$2_$3.html last;
rewrite ^(.*)/archiver/tid-([0-9]+).html$ $1/simple/?t$2.html last;
rewrite ^(.*)/archiver/tid-([0-9]+)-page-([0-9]+).html$ $1/simple/?t$2_$3.html last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/thread.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/read.php?tid=$2&page=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/u.php?action=show&$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/link.php?action=tag&tagname=$2 last;
rewrite ^(.*)/([0-9]+)$ $1/thread.php?fid=$2&page=1 last;

开启服务并重启系统
systemctl enable nginx.service
systemctl enable php-fpm.service
systemctl enable mariadb
systemctl enable memcached.service
systemctl restart nginx
systemctl restart php-fpm
systemctl restart mariadb
service memcached start

域名绑定:
vi /etc/nginx/conf.d/phpwind.conf

内容为:

server {
listen 80;
server_name 自己的域名;
root 自己网站的目录,我的是/usr/share/nginx/phpwind;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
index index.php index.html index.htm;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

include /etc/nginx/rewrite.d/*.conf;

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

下载phpwind9.0.2-utf8到本地http://yqfile.alicdn.com/f/phpwind_v9.0.2_utf8.rar?spm=a2c4e.11155515.0.0.CX3ci6&file=phpwind_v9.0.2_utf8.rar
解压得文件夹phpwind_v9.0.2_utf8_20170401,把其下级文件夹upload重命名为phpwind,然后用psftp工具上传这个重命名的文件夹phpwind到/usr/share/nginx/html/下,这个过程就不描述了
之后,putty命令:
mkdir /usr/share/nginx/phpwind
复制phpwind:
cp -rf /usr/share/nginx/html/phpwind/* /usr/share/nginx/phpwind
设置目录所有者为nginx.nginx, 命令如下:
chown -R nginx.nginx /usr/share/nginx/phpwind

数据库配置,设置用户名dtlln和数据库名adcce(你可以改成自己的名字)
create schema [phpwind数据库名称如我的dtlln] default character set utf8 collate utf8_general_ci;

CREATE USER usernameadcce IDENTIFIED BY '密码';
GRANT ALL PRIVILEGES ON dtlln.* TO 'adcce'@'localhost';
set password for adcce@localhost = password('与上面密码一致');
flush privileges;

putty刷新命令

systemctl restart nginx;
systemctl restart php-fpm;
systemctl restart mariadb;

ie访问自己的域名,安装phpwind,填空那一步,localhost不用改,数据库用户名填dtlln和数据库名填adcce,密码填dtlln的,表前缀自己设或者默认不用改都可以。
phpwind9.0.2 utf8 安装完成

是不是很简单,赶快行动用phpwind!

附:

商业授权
1.购买
https://market.aliyun.com/products/55586021/cmjz000579.html?spm=5176.2020520132.101.5.OURJoz#sku=jichuban
2.访问(等待几分钟)
https://phpwind.aliyun.com/bizauth
3.下载左上角验证文件,上传到网站根目录。
4.点击https://phpwind.aliyun.com/bizauth页面的立即授权,填写域名并确定。
5.下载授权书,完成