blog.zhuohua.store's Archiver

admin 发表于 2019-9-12 21:19

LNMP一键安装包(lnmp_CentOS6.9)

笺注:服务器必须已经连公网,且必须设置网络Yum源,同时服务器的DNS解析要正常!


主机信息:
[root@localhost ~]# cat /etc/redhat-release
[color=Purple]CentOS release 6.9 (Final)[/color]
[root@localhost ~]#
[root@localhost ~]# uname -r
2.6.32-696.el6.x86_64

[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# cat /etc/sysconfig/network |tail -1
HOSTNAME=localhost.localdomain

[root@localhost ~]# ifconfig eth0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}'
[color=Purple]192.168.168.130[/color]


软件可以在官网下载:[url]https://lnmp.org/[/url]


这里安装的是LNMP(Nginx/MySQL/PHP):

yum -y install screen wget
screen -S lnmp
tar -zxf lnmp1.3-full.tar.gz
cd lnmp1.3-full
./install.sh [color=Blue]lnmp[/color]


设置数据库用户root@localhost的密码,默认就是为 [color=Blue]root[/color]
[attach]8493[/attach]


启用InnoDB Storage Engine,输入[color=Blue] Y [/color]再按回车键:
[attach]8494[/attach]


选择数据库版本,这里提供了较多版本的MySQL和MariaDB:
[attach]15027[/attach]


选择PHP版本:
[attach]8496[/attach]


选择是否安装内存优化:
[attach]8497[/attach]


安装或取消安装
[attach]8498[/attach]


下面是全自动安装的^_^ ^_^


安装成功了:(安装好后,最好重启一下服务器)
[attach]8499[/attach]

[attach]8500[/attach]


[attach]8501[/attach]

LNMP架构的安装日志:
[root@localhost ~]# tail -5 [color=Blue]lnmp-install.log[/color]
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      
tcp        0      0 :::22                       :::*                        LISTEN      
[color=Purple]Install lnmp V1.3 completed! enjoy it.
[/color]


自动关闭SELinux的:
[attach]8503[/attach]


自动修改、保存防火墙规则的:
[root@localhost ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Tue Jun 23 02:23:57 2020
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:156]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
[color=Purple]-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j DROP [/color]
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Jun 23 02:23:57 2020

注释:
默认开启了TCP 80端口、关闭了TCP 3306端口;
开启了TCP 80端口,就可以正常访问站点了;
假如要客户端直接连接MySQL才要打开TCP 3306端口;





重启Nginx:
[attach]8505[/attach]


重启MySQL:
[attach]8506[/attach]


重启LNMP:( 会重启Nginx、MySQL、php-fpm )
[attach]8507[/attach]


Nginx、MySQL、php-fpm会随着系统的启动而启动:
[attach]8508[/attach]





PHP版本信息:
[root@localhost ~]# php -v
PHP [color=Purple]5.6.22[/color] (cli) (built: Jun 23 2020 02:21:42)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    [color=Blue]with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies[/color]

备注:
[color=Blue]Zend Guard Loader[/color] 是用于加速PHP的,能提高30%-40%速度;默认会自动安装并启用;
PHP7系列都不再支持Zend Guard Loader


PHP的配置文件:
[root@localhost ~]# find / -name "php.ini"
[color=Purple]/usr/local/php/etc/php.ini[/color]


PHP的配置文件中关于Zend Guard Loader的配置信息:
[root@localhost ~]# vi /usr/local/php/etc/php.ini
[color=Purple][Zend ZendGuard Loader]
zend_extension=/usr/local/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=[/color]





###

MySQL的主配置文件:(查看MySQL的最大连接数)
[root@localhost ~]# cat [color=Blue]/etc/my.cnf[/color] |grep max_connections
max_connections = [color=Purple]500[/color]


更改MySQL的用户root的密码:
cd lnmp1.3-full/tools/
[color=Blue]./reset_mysql_root_password.sh[/color]
[attach]14778[/attach]

输入新的密码:
[attach]14779[/attach]

更改成功:
[attach]14780[/attach]





###

Nginx版本信息:
[root@localhost ~]# nginx -v
nginx version: nginx/[color=Purple]1.10.0[/color]

[root@localhost ~]# nginx -V
nginx version: nginx/[color=Purple]1.10.0[/color]
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module



Nginx的主配置文件:
[root@localhost ~]# head -3 [color=Blue]/usr/local/nginx/conf/nginx.conf[/color]
user  [color=Purple]www[/color] [color=Purple]www[/color];
worker_processes [color=Purple]auto[/color];


[root@localhost ~]# tail -3 /usr/local/nginx/conf/nginx.conf
[color=Purple]include vhost/*.conf;[/color]
}
注释:Nginx会加载/usr/local/nginx/conf/vhost/下后缀为.conf的配置文件(即虚拟主机的Nginx配置文件)


[root@localhost ~]# cat /usr/local/nginx/conf/nginx.conf |grep -A6 "default_server"
        listen [color=DarkRed]80[/color] default_server; [color=RoyalBlue]#Nginx监听TCP 80端口[/color]
        #listen [::]:80 default_server ipv6only=on;
        server_name www.lnmp.org;
        index index.html index.htm index.php;
        root  [color=Purple]/home/wwwroot/default[/color]; [color=RoyalBlue]#默认站点的根目录[/color]
        #error_page   404   /404.html;
        include [color=DarkRed]enable-php.conf[/color]; [color=RoyalBlue]#默认站点引用的Nginx配置文件[/color]


默认站点引用的Nginx配置文件:
[root@localhost ~]# cd /usr/local/nginx/conf
[root@localhost conf]# cat [color=DarkRed]enable-php.conf[/color]
        location ~ [^/]\.php(/|$)
        {
            try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
        }


默认站点已经就开启了Nginx的status页面:
[root@localhost ~]# cat /usr/local/nginx/conf/nginx.conf |grep -A4 "nginx_status"
        location [color=Blue]/nginx_status[/color]
        {
            stub_status on;
            access_log   off;
        }


客户端远程访问Nginx的status页面:
http://192.168.168.130[color=Blue]/nginx_status[/color]
[attach]14781[/attach]





直接访问服务器IP( [color=Blue]http://192.168.168.130[/color] )可以看到这个页面:
[attach]8514[/attach]


默认站点的根目录:
[attach]15028[/attach]


PHP探针:( http://192.168.168.130[color=Blue]/p.php[/color] )
[attach]15029[/attach]


PHP测试页:( http://192.168.168.130[color=Blue]/phpinfo.php[/color] )
[attach]15030[/attach]

[attach]15031[/attach]



phpMyAdmin:( http://192.168.168.130[color=Blue]/phpmyadmin/[/color] )
[attach]15032[/attach]

[attach]8520[/attach]

注释:
客户端要访问phpMyAdmin,服务器的防火墙打开TCP 80端口就可以了,无需打开TCP 3306端口;




数据库的默认字符集是 [color=Blue]utf8mb4_general_ci[/color] :
[attach]14786[/attach]


可以在phpMyAdmin创建库:
[attach]14787[/attach]
注释:新建数据库时,不指定排序规则(字符集),就是使用默认字符集。

创建库成功:
[attach]14788[/attach]



创建数据库用户([color=Blue]zhuohua@localhost[/color])并赋权:
GRANT all on *.* to [color=Blue]zhuohua@localhost[/color] identified BY "168"
[attach]14789[/attach]
注释:还要点击右下角的“执行”按键。


查看所有数据库用户:
[attach]14790[/attach]







######
Pureftpd (一款FTP服务器软件)

运行脚本,安装Pureftpd:
cd /root/lnmp1.3-full
./pureftpd.sh

[attach]8521[/attach]

Pureftpd安装成功:
[attach]8522[/attach]


[root@localhost ~]# ps -ef |grep [color=Blue]pure-ftpd[/color] |grep -v grep
root       9496      1  0 03:05 ?        00:00:00 pure-ftpd (SERVER)

[root@localhost ~]# service [color=DarkRed]pureftpd[/color] status
Pure-FTPd is running.


Pureftpd会随着系统的启动而启动:
[root@localhost ~]# chkconfig --list [color=DarkRed]pureftpd[/color]
pureftpd        0:关闭  1:关闭  2:启用  [color=Purple]3:启用[/color]  4:启用  [color=Purple]5:启用[/color]  6:关闭


Pureftpd的关闭、启动:

[root@localhost ~]# service pureftpd stop
Stopping Pure-FTPd...   done

[root@localhost ~]# ps -ef |grep pure-ftpd |grep -v grep
[root@localhost ~]#
[root@localhost ~]# echo $?
[color=Purple]1[/color]


[root@localhost ~]# service pureftpd start
Starting Pure-FTPd... Running: /usr/local/pureftpd/sbin/pure-ftpd --daemonize -A -c50 -B -C10 -D -E -fftp -H -I15 -lpuredb:/usr/local/pureftpd/etc/pureftpd.pdb -lunix -L2000:8 -m4 -p20000:30000 -s -U133:022 -u100 -g/var/run/pure-ftpd.pid -k99 -Z
done

[root@localhost ~]# ps -ef |grep pure-ftpd |grep -v grep
root       9604      1  0 03:12 ?        00:00:00 pure-ftpd (SERVER)  
[root@localhost ~]#
[root@localhost ~]# echo $?
[color=Purple]0[/color]



Pureftpd在防火墙对应的端口:
[root@localhost ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Tue Jun 23 02:54:54 2020
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2:841]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j DROP
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
[color=Purple]-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20000:30000 -j ACCEPT [/color]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Jun 23 02:54:54 2020











######

添加基于域名的虚拟主机(站点):( 用于 Discuz!7.2 )
[color=Blue]lnmp vhost add[/color]
[attach]8525[/attach]


伪静态:
[attach]15033[/attach]


站点日志:
[attach]15034[/attach]


这里不给站点创建数据库了:
[attach]8528[/attach]


给此站点创建FTP用户:(这里创建的FTP用户对本站点目录有完全控制的权限)
[attach]8529[/attach]


站点 [color=Blue]blog.zhuohua.store[/color] 的配置信息:
[attach]14791[/attach]



站点 [color=Blue]blog.zhuohua.store[/color] 的Nginx配置文件:
[root@localhost ~]# cat /usr/local/nginx/conf/vhost/[color=Blue]blog.zhuohua.store.conf[/color] |grep -v ^$
server
    {
        listen [color=DarkRed]80[/color]; [color=RoyalBlue]#监听的端口为TCP 80[/color]
        #listen [::]:80;
        server_name blog.zhuohua.store;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/blog.zhuohua.store;
        include [color=Blue]other.conf[/color];  [color=RoyalBlue]#此站点使用的伪静态规则文件[/color]
        #error_page   404   /404.html;
        include enable-php.conf;
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
        location ~ /\.
        {
            deny all;
        }
        access_log  [color=Blue]/home/wwwlogs/blog.zhuohua.store.log[/color]; [color=RoyalBlue]#此站点的日志文件[/color]
}

笺注:不同站点可以使用不同的伪静态规则文件。


Nginx的伪静态规则文件的默认存放目录:(自带了一些伪静态规则文件)
[attach]15035[/attach]
注释:截图有省略。


Discuz!7.2其实不用伪静态也无妨:(文件[color=Blue]other.conf[/color]本来就是空的)
[attach]8533[/attach]


其他一些自带的Nginx伪静态规则文件:
[root@localhost conf]# cat discuz.conf
[color=Purple]location / {
            rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
            rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
        }[/color]



[root@localhost conf]# cat discuzx.conf
[color=Purple]rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
        return 404;
}[/color]



笺注:
Nginx的伪静态文件也可以是 [color=Blue].htaccess[/color] ,但Nginx的伪静态规则与Apache的伪静态规则是不一样的,两者不通用的!!!



######

安装Discuz!7.2

软件Discuz!7.2的下载:[url]https://pan.baidu.com/s/1tOYy1t1Bqkvc5Wr7ulk-PA[/url]

服务器本地的操作:
[root@localhost ~]# ls -alh *.zip
-rw-r--r-- 1 root root 4.5M 9月   1 2019 [color=Purple]Discuz_7.2_FULL_SC_UTF8.zip[/color]

unzip Discuz_7.2_FULL_SC_UTF8.zip -d discuz
cp -rfp discuz/upload/* /home/wwwroot/blog.zhuohua.store/
chown -R www.www /home/wwwroot/blog.zhuohua.store/

[attach]15045[/attach]
注释:截图有省略。

备注:
站点目录下的文件和文件夹的属主和属组都要设置为 [color=Blue]www[/color]
环境支持htm、html、php这三种网页 ^_^  ^_^  ^_^



###

Windows客户端通过浏览器继续安装Discuz!7.2

在没有DNS服务器解析域名的情况下,可以在文件hosts里绑定:
[attach]8535[/attach]


记得设置文件hosts的权限:
[attach]8536[/attach]


http://blog.zhuohua.store[color=Blue]/install/[/color]
[attach]8537[/attach]


[attach]8538[/attach]
备注:没有错误才能点击“下一步”按键。


[attach]14794[/attach]
备注:这里自动创建的库[color=Blue]discuz[/color]的字符集为 [color=Blue]utf8_general_ci[/color]


[attach]8540[/attach]


Discuz!7.2搭建成功了
[attach]8541[/attach]





服务器本地登录MySQL:
[attach]8542[/attach]


查看数据库用户([color=Blue]zhuohua@localhost[/color])的权限:
mysql> show grants for [color=Blue]zhuohua@localhost[/color];
+-------------------------------------------------------------------------------------------------------------------------+
| Grants for zhuohua@localhost                                                                                            |
+-------------------------------------------------------------------------------------------------------------------------+
| [color=Purple]GRANT ALL PRIVILEGES ON *.* TO 'zhuohua'@'localhost' IDENTIFIED BY PASSWORD '*242E46A1E8D30FE06F7CE37B55BFC25BA981D70C'[/color] |
+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

注释:数据库用户([color=Blue]zhuohua@localhost[/color])的权限可以管理所有库。



查看所有的库:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| db1                |
| [color=Purple]discuz [/color]            |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)


查看库[color=Blue]discuz[/color]的字符集:
mysql> show create database [color=Blue]discuz[/color];
+----------+-----------------------------------------------------------------+
| Database | Create Database                                                 |
+----------+-----------------------------------------------------------------+
| discuz   | [color=Purple]CREATE DATABASE `discuz` /*!40100 DEFAULT CHARACTER SET utf8 */[/color] |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)

注释:库[color=Blue]discuz[/color]的字符集为 [color=Blue]utf8_general_ci[/color]





登录phpMyAdmin也可以看到程序自动创建的库[color=Blue]discuz[/color]:
[attach]14795[/attach]
备注:可以看到库[color=Blue]discuz[/color]的字符集为 [color=Blue]utf8_general_ci[/color]




Discuz!X7.2的全局配置文件:
[root@localhost ~]# cd /home/wwwroot/blog.zhuohua.store/
[root@localhost blog.zhuohua.store]# ll [color=Blue]config.inc.php[/color]
-rw-r--r-- 1 www www 4185 6月  23 03:45 config.inc.php

Discuz!X7.2的数据库配置信息:
[root@localhost blog.zhuohua.store]# vi config.inc.php
[attach]14796[/attach]



假如更改了配置文件中的用户密码:
[attach]14797[/attach]


客户端对Discuz!7.2的访问即失败,如下图:
[attach]14798[/attach]


解决方法:
要更改数据库用户([color=Blue]zhuohua@localhost[/color])的密码:
[attach]14799[/attach]


[attach]14800[/attach]
注释:数据库用户([color=Blue]zhuohua@localhost[/color])的密码要与该站点的配置文件中的用户密码一致;还要点击右下角的“执行”按键。


客户端对Discuz!7.2的访问恢复正常,如下图:
[attach]14801[/attach]



使用FTP用户[color=Blue]ftp1[/color]进行FTP连接:(会直接连接到站点blog.zhuohua.store的文件存放目录/home/wwwroot/blog.zhuohua.store/)
[attach]15036[/attach]
注释:连接的IP地址为服务器IP地址。

FTP用户[color=Blue]ftp1[/color]对目录/home/wwwroot/blog.zhuohua.store/有完全控制的权限:(可以上传、下载文件、目录等等)
[attach]15037[/attach]



[b][size=5]笺注:本站点也是使用这些软件,基于这个架构的^_^ ^_^[/size][/b]














######

安装Wordpress

先创建库:
[attach]14802[/attach]
注释:可以自定义单个库的字符集。

[attach]14803[/attach]


创建数据库用户([color=Blue]happy@localhost[/color])并赋权:
GRANT all on wordpress.* to [color=Blue]happy@localhost[/color] identified BY "1688"
[attach]14804[/attach]
注释:还要点击右下角的“执行”按键。


查看数据库用户(happy@localhost)的权限:
[attach]14805[/attach]


[attach]14806[/attach]
注释:数据库用户(happy@localhost)只对库[color=Blue]wordpress[/color]有完全控制的权限。





添加基于域名的虚拟主机(站点):( 用于 Wordpress )
[color=Blue]lnmp vhost add[/color]
[attach]8552[/attach]


伪静态:
[attach]15038[/attach]


[attach]8554[/attach]


站点 [color=Blue]word.zhuohua.store[/color] 的配置信息:
[attach]14807[/attach]



站点 [color=Blue]word.zhuohua.store[/color] 的Nginx配置文件:
[root@localhost ~]# cat /usr/local/nginx/conf/vhost/[color=Blue]word.zhuohua.store.conf[/color] |grep -v ^$
server
    {
        listen 80;
        #listen [::]:80;
        server_name word.zhuohua.store www.zhuohua.store;  [color=RoyalBlue]#站点域名、别名之间用空格隔开[/color]
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/word.zhuohua.store;
        include [color=Blue]wordpress.conf[/color];  [color=RoyalBlue]#此站点使用的伪静态规则文件[/color]
        #error_page   404   /404.html;
        include enable-php.conf;
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
        location ~ /\.
        {
            deny all;
        }
        access_log [color=DarkRed]off[/color];  [color=RoyalBlue]#关闭这个站点的日志功能[/color]
}



自带的关于Wordpress的伪静态规则文件:
[root@localhost ~]# cd /usr/local/nginx/conf/
[root@localhost conf]# ll [color=Blue]wordpress.conf[/color]
-rw-r--r--. 1 root root 151 6月  23 2020 wordpress.conf

[root@localhost conf]# cat wordpress.conf
[color=Purple]location / {
        try_files $uri $uri/ /index.php?$args;
}

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;[/color]

笺注:
Wordpress 其实不用伪静态也无妨。



软件WordPress的下载:[url]https://pan.baidu.com/s/1PS9v1TLpfH7kvHdnrGtmLw[/url]

服务器本地的操作:
[root@localhost ~]# tar -zxvf wordpress-4.5.3-zh_CN.tar.gz
[root@localhost ~]# mv -f wordpress/* /home/wwwroot/word.zhuohua.store/
[root@localhost ~]# chown -R www.www /home/wwwroot/word.zhuohua.store/

备注:
站点目录下的文件和文件夹的属主和属组都要设置为 [color=Blue]www[/color]
环境支持htm、html、php这三种网页 ^_^  ^_^  ^_^


###
Windows客户端通过浏览器继续安装Wordpress

在没有DNS服务器解析域名的情况下,可以在文件hosts里绑定:
[attach]8560[/attach]


http://word.zhuohua.store/
[attach]8561[/attach]


填写数据库连接信息:
[attach]14808[/attach]


[attach]14810[/attach]


[attach]14809[/attach]


[attach]14811[/attach]


[attach]14812[/attach]


登录后访问的是Wordpress的后台:
[attach]14813[/attach]



访问Wordpress的前端:
http://word.zhuohua.store/
或者
http://www.zhuohua.store/
[attach]14814[/attach]



[size=4]笺注:
伪静态的好处是利于SEO,容易被搜索引擎收录;伪静态的页面后缀一般为html、htm或目录格式;伪静态只是改变了URL的表现形式,实际上仍然是动态页面。
伪静态会增加服务器的资源消耗。[/size]


站点虽然使用了伪静态规则文件,但Wordpress还没有真正开启伪静态功能:
[attach]14815[/attach]


Wordpress还要在后台开启伪静态功能:
设置》固定链接》固定链接设置
选择自定义结构,加上 [color=Blue]/%post_id%.html[/color]
[attach]15039[/attach]


伪静态开启成功:( 文章的URL的表现形式都显示为静态页面 )
[attach]14819[/attach]


伪静态开启后,也不是说所有URL的表现形式都显示为静态页面:
[attach]14817[/attach]




Wordpress的全局配置文件:
[root@localhost ~]# cd /home/wwwroot/word.zhuohua.store/
[root@localhost word.zhuohua.store]# ll [color=Blue]wp-config.php[/color]
-rw-rw-rw- 1 www www 3203 1月  21 16:18 wp-config.php

Wordpress的数据库配置信息:
[root@localhost word.zhuohua.store]# vi wp-config.php
[attach]14818[/attach]



服务器本地查看数据库用户(happy@localhost)的权限:
[root@localhost ~]# mysql -u"root" -p"888" -e [color=Blue]"show grants for happy@localhost;"[/color]
+--------------------------------------------------------------------------------------------------------------+
| Grants for happy@localhost                                                                                   |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'happy'@'localhost' IDENTIFIED BY PASSWORD '*398D8BD83BF246533D81FF0E614402C6505D0EED' |
|[color=Purple] GRANT ALL PRIVILEGES ON `wordpress`.* TO 'happy'@'localhost' [/color]                                                |
+--------------------------------------------------------------------------------------------------------------+

注释:数据库用户(happy@localhost)只对库[color=Purple]wordpress[/color]有完全控制的权限。











########
########

查看虚拟主机(站点)列表:
[attach]8559[/attach]


删除虚拟主机:
lnmp vhost del
[attach]15040[/attach]


需要手动删除站点[color=Blue]word.zhuohua.store[/color]的目录:
[root@localhost ~]# cd /home/wwwroot/
[root@localhost wwwroot]# ll
总用量 12
drwxr-xr-x  18 www www 4096 6月  23 2020 blog.zhuohua.store
drwxr-xr-x.  3 www www 4096 6月  23 2020 default
drwxr-xr-x   5 www www 4096 1月  21 16:18 [color=Purple]word.zhuohua.store[/color]
[root@localhost wwwroot]#
[root@localhost wwwroot]# rm -rf word.zhuohua.store/
[color=Red]rm: 无法删除"word.zhuohua.store/.user.ini": 不允许的操作[/color]

[root@localhost wwwroot]# lsattr word.zhuohua.store/.user.ini
[color=Purple]----i--------e-[/color] word.zhuohua.store/.user.ini
[root@localhost wwwroot]#
[root@localhost wwwroot]# [color=Blue]chattr -i[/color] word.zhuohua.store/.user.ini
[root@localhost wwwroot]#
[root@localhost wwwroot]# lsattr word.zhuohua.store/.user.ini
[color=Purple]-------------e-[/color] word.zhuohua.store/.user.ini
[root@localhost wwwroot]#
[root@localhost wwwroot]# [color=Blue]rm -rf word.zhuohua.store[/color]
[root@localhost wwwroot]#
[root@localhost wwwroot]# ls
blog.zhuohua.store  default



需要手动删除站点[color=Blue]word.zhuohua.store[/color]的数据库:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| discuz             |
| mysql              |
| performance_schema |
| [color=Purple]wordpress[/color]          |
+--------------------+
5 rows in set (0.00 sec)

mysql> [color=Blue]drop database wordpress;[/color]
Query OK, 12 rows affected (0.06 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| discuz             |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

mysql>







########

卸载LNMP架构:
[attach]15041[/attach]


[attach]15042[/attach]


[attach]15043[/attach]







########

卸载Pureftpd:(这个要另外卸载)
cd /root/lnmp1.3-full
./pureftpd.sh uninstall

Pureftpd卸载成功:
[attach]15044[/attach]






相关文章:
[url=http://blog.zhuohua.store/viewthread.php?tid=45&page=1&extra=#pid46]Windows2008R2_UPUPW搭建WordPress+Discuz!7.2[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=398&page=1&extra=#pid826]UPUPW_Np7.0_OPcache+Memcache+Redis[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=85&page=1&extra=#pid86]PHP5.6+Zend Guard Loader/Zend OPcache[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=32&extra=page%3D1]CentOS6安装服务器安全狗、Nginx版网站安全狗[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=246&page=1&extra=#pid249]Linux常用命令(一)[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=247&page=1&extra=#pid250]Linux常用命令(二)[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=87&page=1&extra=#pid88]本地备份站点目录和数据库+crontab计划任务[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=88&page=1&extra=#pid89]远程备份站点目录和数据库+at一次性计划任务[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=230&page=1&extra=#pid233]使用SQLyog远程管理MySQL[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=233&page=1&extra=#pid236]重置MySQL5.5/5.6/5.7的用户密码[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=106&extra=page%3D1]忽略Linux下MySQL5.5的表名的英文字母大小写[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=234&extra=page%3D1]MySQL的字符集[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=235&page=1&extra=#pid238]MySQL的表的存储引擎[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=109&page=1&extra=#pid110]MySQL恢复误删除的数据[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=82&extra=page%3D1]更新Nginx版本+Nginx版网站安全狗[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=84&extra=page%3D1]Nginx代理虚拟主机[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=291&extra=page%3D1]Nginx用户验证[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=293&page=1&extra=#pid296]Nginx的并发连接数[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=292&page=1&extra=#pid295]Nginx基于域名的虚拟主机/域名重定向/访问控制/防盗链/SSL[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=89&page=1&extra=#pid90]切割Nginx的日志文件[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=192&extra=page%3D1]在阿里云修改服务器CentOS6.9的SSH端口号[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=468&page=1&extra=#pid896]CentOS8_lnmp1.7_LAMP[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=265&page=1&extra=#pid268]Zabbix使用SNMP监控CentOS6/Redhat6[/url]

[url=http://blog.zhuohua.store/viewthread.php?tid=80&extra=page%3D1]LNMP一键安装包(lamp_CentOS6.9)[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=81&extra=page%3D1]LNMP一键安装包(lnmpa_CentOS6.9)[/url]




#################################
#################################
[url=https://weidian.com/?userid=823531601&wfr=wx&sfr=app&source=shop]亲,学习研究也要劳逸结合哦,来我微店逛逛,买点东西好好犒劳犒劳自己和家人吧^_^^_^[/url]

[url=https://weidian.com/item.html?itemID=905482571142055892189&wfr=wx&sfr=app&source=goods_home]FaSoLa免磨陶瓷刀具 抗氧化厨房切菜刀水果刀切肉刀 寿命长[/url]
[url=https://weidian.com/item.html?itemID=905482571142055892189&wfr=wx&sfr=app&source=goods_home][attach]1910[/attach][/url]

[url=https://weidian.com/item.html?itemID=905482571141728237870&wfr=wx&sfr=app&source=goods_home]【宝家洁】喷雾喷水拖把平板拖把大号 高档木地板除尘 不用手洗的创意拖把 懒人必备[/url]
[url=https://weidian.com/item.html?itemID=905482571141728237870&wfr=wx&sfr=app&source=goods_home][attach]1912[/attach][/url]

[url=https://weidian.com/item.html?itemID=905482571141909976633&wfr=wx&sfr=app&source=goods_home]薇语馨 (促销价)6833#夏季新款收腰显瘦蝙蝠袖露肩复古雪纺连衣裙波浪裙子邻家女孩 好质量 支持无理由退货[/url]
[url=https://weidian.com/item.html?itemID=905482571141909976633&wfr=wx&sfr=app&source=goods_home][attach]1911[/attach][/url]

[url=https://weidian.com/item.html?itemID=905482571142603445901&wfr=wx&sfr=app&source=goods_home]薇语馨1852真丝连衣裙套装裙两件套系带宽松大码不规则裙子女[/url]
[url=https://weidian.com/item.html?itemID=905482571142603445901&wfr=wx&sfr=app&source=goods_home][attach]1909[/attach][/url]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.