服务器IP地址规划:client:12.0.0.12/24,网关服务器:ens36:12.0.0.1/24、ens33:192.168.11.1/24;Web1:192.168.11.10/24,Web2:192.168.11.11/24,Nginx:192.168.11.9/24。
1 Nginx服务器——编译安装Nginx
[root@mcb-11-9 ~]#yum -y install pcre-devel zlib-devel gcc gcc-c++ make
#安装依赖环境
[root@mcb-11-9 ~]#useradd -M -s /sbin/nologin nginx
#创建程序管理用户Nginx
[root@mcb-11-9 opt]#cd /opt
[root@mcb-11-9 opt]#wget http://nginx.org/download/nginx-1.18.0.tar.gz
#下载压缩文件
[root@mcb-11-9 opt]#ls
nginx-1.18.0.tar.gz
[root@mcb11-9 opt]#tar xf nginx-1.18.0.tar.gz
[root@mcb-11-9 opt]#cd nginx-1.18.0/
[root@mcb-11-9 nginx-1.18.0]#./configure \ 编译安装
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module
[root@mcb-11-9 nginx-1.18.0]#make -j2
[root@mcb-11-9 nginx-1.18.0]#make install
[root@mcb-11-9 nginx-1.18.0]#ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@mcb-11-9 nginx-1.18.0]#vim /lib/systemd/system/nginx.service 编译多行重定向
[root@mcb-11-9 nginx-1.18.0]#cat /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -1 $MAINPID
ExecStop=/bin/kill -3 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@-11-9 nginx-1.18.0]#systemctl daemon-reload
[root@mcb-11-9 nginx-1.18.0]#systemctl enable --now nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@mcb-11-9 nginx-1.18.0]#systemctl status nginx.service
● nginx.service - nginx
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since 六 2024-03-09 12:37:29 CST; 4s ago
Process: 39778 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 39779 (nginx)
CGroup: /system.slice/nginx.service
├─39779 nginx: master process /usr/local/nginx/sbin/nginx
└─39780 nginx: worker process
3月 09 12:37:29 mvb.D systemd[1]: Starting nginx...
3月 09 12:37:29 mcb.D systemd[1]: Started nginx.
[root@mcb-11-9 nginx-1.18.0]#chown -R nginx:nginx /usr/local/nginx/
2 Nginx服务器——搭建PHP
[root@mcb-11-9 ~]#cd /opt
[root@mcb-11-9 ~]#yum -y install gd \ 安装环境依赖包
> libjpeg libjpeg-devel \
> libpng libpng-devel \
> freetype freetype-devel \
> libxml2 libxml2-devel \
> zlib zlib-devel \
> curl curl-devel \
> openssl openssl-devel
[root@mcb-11-9 opt]#rz -E
rz waiting to receive.
[root@mcb-11-9 opt]#ls
nginx-1.18.0 nginx-1.18.0.tar.gz php-7.1.10.tar.bz2
[root@mcb-11-9 opt]#tar xf php-7.1.10.tar.bz2
[root@mcb-11-9 opt]#cd php-7.1.10/
[root@mcb-11-9 php-7.1.10]#./configure \ 编译安装
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
[root@mcb-11-9 php-7.1.10]#make -j2
[root@mcb-11-9 php-7.1.10]#make install
[root@mcb-11-9 php-7.1.10]#ln -s /usr/local/php/bin/* /usr/local/bin/
[root@mcb-11-9 php-7.1.10]#ln -s /usr/local/php/sbin/* /usr/local/sbin/
#优化路径
#调整进程服务配置文件
[root@mcb-11-9 php-7.1.10]#cp /opt/php-7.1.10/php.ini-development /usr/local/php/lib/php.ini
[root@mcb-11-9 php-7.1.10]#vim /usr/local/php/lib/php.ini
-1170G- mysqli.default_socket = /usr/local/mysql/mysql.sock
-939G- date.timezone = Asia/Shangha
[root@mcb-11-9 php-7.1.10]#sed -n '939p;1170p' /usr/local/php/lib/php.ini
date.timezone = Asia/Shanghai
mysqli.default_socket = /usr/local/mysql/mysql.sock
[root@mcb-11-9 php-7.1.10]#cd /usr/local/php/etc/
[root@mcb-11-9 etc]#cp php-fpm.conf.default php-fpm.conf
[root@mcb-11-9 etc]#vim php-fpm.conf
[root@mcb-11-9 etc]#sed -n '17p' php-fpm.conf
pid = run/php-fpm.pid
#调整扩展配置文件
[root@mcb-11-9 etc]#cd /usr/local/php/etc/php-fpm.d/
[root@mcb-11-9 php-fpm.d]#cp www.conf.default www.conf
[root@mcb-11-9 php-fpm.d]#ls
www.conf www.conf.default
#启动PHP
[root@mcb-11-9 php-fpm.d]#cp /opt/php-7.1.10/sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
[root@mcb-11-9 php-fpm.d]#systemctl restart php-fpm.service
[root@mcb-11-9 php-fpm.d]#systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: active (running) since 六 2024-03-09 13:01:36 CST; 5s ago
Main PID: 47397 (php-fpm)
CGroup: /system.slice/php-fpm.service
├─47397 php-fpm: master process (/usr/local/php/etc/php-fpm.con...
├─47400 php-fpm: pool www
└─47401 php-fpm: pool www
3月 09 13:01:36 G.D systemd[1]: Started The PHP FastCGI Process Manager.
3月 09 13:01:36 G.D systemd[1]: Starting The PHP FastCGI Process Manager...
Hint: Some lines were ellipsized, use -l to show in full.
3 编译安装搭建mysql
[root@G opt]#yum -y install \
> ncurses \
> ncurses-devel \
> bison \
> cmake
#环境依赖包
[root@G opt]#yum -y install gcc gcc-c++ cmake bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel
#安装依赖环境
[root@G opt]#useradd -M -s /sbin/nologin mysql
#创建运行用户
[root@G opt]#rz -E
rz waiting to receive.
[root@G opt]#ls
mysql-boost-5.7.20.tar.gz nginx-1.18.0.tar.gz php-7.1.10.tar.bz2
nginx-1.18.0 php-7.1.10
[root@G opt]#tar xf mysql-boost-5.7.20.tar.gz
[root@G opt]#cd mysql-5.7.20/
[root@G mysql-5.7.20]#cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
> -DSYSCONFDIR=/etc \
> -DSYSTEMD_PID_DIR=/usr/local/mysql \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DWITH_EXTRA_CHARSETS=all \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
> -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
> -DMYSQL_DATADIR=/usr/local/mysql/data \
> -DWITH_BOOST=boost \
> -DWITH_SYSTEMD=1
[root@mcb-11-9 mysql-5.7.20]#make -j2
[root@mcb-11-9 mysql-5.7.20]#make install
[root@mcb-11-9 mysql-5.7.20]#vim /etc/my.cnf
#修改mysql配置文件
[root@mcb-11-9 mysql-5.7.20]#cat /etc/my.cnf
[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
[root@mcb-11-9 mysql-5.7.20]#chown -R mysql:mysql /usr/local/mysql/
[root@mcb-11-9 mysql-5.7.20]#chown mysql:mysql /etc/my.cnf
#更改mysql安装目录和配置文件的属主属组
[root@mcb-11-9 mysql-5.7.20]#echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
#设置路径环境变量
[root@mcb-11-9 mysql-5.7.20]#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@mcb-11-9 mysql-5.7.20]#source /etc/profile
[root@mcb-11-9 mysql-5.7.20]#echo $PATH
/usr/local/mysql/bin:/usr/local/mysql/lib:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@G mysql-5.7.20]#cd /usr/local/mysql/bin/
[root@G bin]#./mysqld \
> --initialize-insecure \
> --user=mysql \
> --basedir=/usr/local/mysql \
> --datadir=/usr/local/mysql/data
#初始化数据库
[root@G bin]#cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service
/usr/lib/systemd/system/
#添加mysqld系统服务
[root@G bin]#systemctl daemon-reload
[root@G bin]#systemctl start mysqld.service
[root@G bin]#systemctl enable mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[root@G bin]#systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 六 2024-03-09 13:46:17 CST; 8s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 66268 (mysqld)
CGroup: /system.slice/mysqld.service
└─66268 /usr/local/mysql/bin/mysqld --daemonize --pid-file=/usr...
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.637646Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.637658Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.637661Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.637667Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.638510Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.638519Z 0 [Warni...e.
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.642575Z 0 [Note]...ts
3月 09 13:46:17 G.D mysqld[66265]: 2024-03-09T05:46:17.642946Z 0 [Note]...s.
3月 09 13:46:17 G.D mysqld[66265]: Version: '5.7.20' socket: '/usr/loc...on
3月 09 13:46:17 G.D systemd[1]: Started MySQL Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@G ~]#mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.20 Source distribution
Copyright (c) 2000, 2017, 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> ^DBye
4 修改nginx文本,配置PHP测试页
[root@mcb-11-9 ~]#vim /usr/local/nginx/conf/nginx.conf
[root@mcb-11-9 ~]#sed -n '65,71p' /usr/local/nginx/conf/nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
[root@mcb-11-9 ~]#systemctl restart nginx
[root@mcb-11-9 ~]#systemctl status nginx.service
● nginx.service - nginx
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since 六 2024-03-09 13:53:04 CST; 5s ago
Process: 1844 ExecStop=/bin/kill -3 $MAINPID (code=exited, status=0/SUCCESS)
Process: 1849 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 1851 (nginx)
CGroup: /system.slice/nginx.service
├─1851 nginx: master process /usr/local/nginx/sbin/nginx
└─1852 nginx: worker process
3月 09 13:53:04 G.D systemd[1]: Starting nginx...
3月 09 13:53:04 G.D systemd[1]: Started nginx.
[root@mcb-11-9 ~]#vim /usr/local/nginx/html/index.php
[root@mcb-11-9 ~]#cat /usr/local/nginx/html/index.php
<?php
$link=mysqli_connect('192.168.241.24','bbsuser','admin123');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
?>
[root@mcb-11-9 ~]#systemctl restart nginx
5 配置数据库
[root@mcb-11-9 ~]#mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.20 Source distribution
Copyright (c) 2000, 2017, 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> CREATE DATABASE bbs;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> GRANT all ON bbs.* TO 'bbsuser'@'localhost' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> ^DBye
6 安装论坛
[root@mcb-11-9 ~]#cd /opt
[root@mcb-11-9 opt]#unzip Discuz_X3.4_SC_UTF8.zip
[root@mcb-11-9 opt]#ls
dir_SC_UTF8 mysql-boost-5.7.20.tar.gz php-7.1.10
Discuz_X3.4_SC_UTF8.zip nginx-1.18.0 php-7.1.10.tar.bz2
mysql-5.7.20 nginx-1.18.0.tar.gz 说明.htm
[root@mcb-11-9 opt]#cd dir_SC_UTF8/
[root@mcb-11-9 dir_SC_UTF8]#cp -r upload/ /usr/local/nginx/html/bbs
[root@mcb-11-9 dir_SC_UTF8]#cd /usr/local/nginx/html/bbs/
[root@mcb-11-9 bbs]#ls
admin.php connect.php group.php member.php search.php uc_server
api crossdomain.xml home.php misc.php source
api.php data index.php plugin.php static
archiver favicon.ico install portal.php template
config forum.php m robots.txt uc_client
[root@mcb-11-9 bbs]#chown -R nginx.nginx ./config/
[root@mcb-11-9 bbs]#chown -R nginx.nginx ./data/
[root@mcb-11-9 bbs]#chown -R nginx.nginx ./uc_client/
[root@mcb-11-9 bbs]#chown -R nginx.nginx ./uc_server/
[root@mcb-11-9 bbs]#chmod -R 777 ./config/
[root@mcb-11-9 bbs]#chmod -R 777 ./data/
[root@mcb-11-9 bbs]#chmod -R 777 ./uc_client/
[root@mcb-11-9 bbs]#chmod -R 777 ./uc_server/
[root@mcb-11-9 bbs]#vim /usr/local/nginx/conf/nginx.conf
[root@mcb-11-9 bbs]#sed -n '43,46p' /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm index.php;
}
web-1 2---搭建tomcat
安装Oracle JDK
[root@node2 ~]#cd /opt
[root@node2 opt]#rm -rf *
[root@node2 opt]#ls
[root@node2 opt]#rz -E
rz waiting to receive.
[root@node2 opt]#ls
jdk-8u291-linux-x64.tar.gz
[root@node2 opt]#tar xf jdk-8u291-linux-x64.tar.gz -C /usr/local/
[root@node2 opt]#cd /usr/local/
[root@node2 local]#ls
bin games jdk1.8.0_291 lib64 sbin src
etc include lib libexec share
[root@node2 local]#ln -s jdk1.8.0_291/ jdk
[root@node2 local]#ls
bin games jdk lib libexec share
etc include jdk1.8.0_291 lib64 sbin src
[root@node2 local]#vim /etc/profile.d/jdk.sh
[root@node2 local]#cat /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib/:$JRE_HOME/lib/
[root@node2 local]#. /etc/profile.d/jdk.sh
[root@node2 local]#java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
安装tomcat
[root@node2 local]#cd /opt
[root@node2 opt]#ls
jdk-8u291-linux-x64.tar.gz
[root@node2 opt]#rz -E
rz waiting to receive.
[root@node2 opt]#ls
apache-tomcat-9.0.16.tar.gz jdk-8u291-linux-x64.tar.gz
[root@node2 opt]#tar xf apache-tomcat-9.0.16.tar.gz -C /usr/local/
[root@node2 opt]#cd /usr/local/
[root@node2 local]#ls
apache-tomcat-9.0.16 etc include jdk1.8.0_291 lib64 sbin src
bin games jdk lib libexec share
[root@node2 local]#mv apache-tomcat-9.0.16/ tomcat
[root@node2 local]#ls
bin games jdk lib libexec share tomcat
etc include jdk1.8.0_291 lib64 sbin src
[root@node2 local]#cd tomcat/
[root@node2 tomcat]#ls
bin CONTRIBUTING.md logs RELEASE-NOTES webapps
BUILDING.txt lib NOTICE RUNNING.txt work
conf LICENSE README.md temp
[root@node2 tomcat]#useradd -M -s /sbin/nologin tomcat
[root@node2 tomcat]#cat > /usr/lib/systemd/system/tomcat.service <<EOF
> [Unit]
> Description=Tomcat
> After=syslog.target network.target
>
> [Service]
> Type=forking
> ExecStart=/usr/local/tomcat/bin/startup.sh
> ExecStop=/usr/local/tomcat/bin/shutdown.sh
> RestartSec=3
> PrivateTmp=true
> User=tomcat
> Group=tomcat
>
> [Install]
> WantedBy=multi-user.target
>
> EOF
[root@node2 tomcat]#cat /usr/lib/systemd/system/tomcat.service
[Unit]
Description=Tomcat
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/tomcat/bin/startup.sh
ExecStop=/usr/local/tomcat/bin/shutdown.sh
RestartSec=3
PrivateTmp=true
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target
[root@node2 tomcat]#chown -R tomcat:tomcat ../tomcat
[root@node2 tomcat]#systemctl daemon-reload
[root@node2 tomcat]#systemctl start tomcat
[root@node2 tomcat]#systemctl status tomcat
● tomcat.service - Tomcat
Loaded: loaded (/usr/lib/systemd/system/tomcat.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2024-03-09 00:16:33 EST; 4s ago
Process: 4938 ExecStart=/usr/local/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS)
Main PID: 4954 (catalina.sh)
CGroup: /system.slice/tomcat.service
├─4954 /bin/sh /usr/local/tomcat/bin/catalina.sh start
└─4955 /usr/bin/java -Djava.util.logging.config.file=/usr/local...
Mar 09 00:16:33 node2.localdomain systemd[1]: Starting Tomcat...
Mar 09 00:16:33 node2.localdomain systemd[1]: Started Tomcat.
1)在Nginx服务器上搭建LNMP服务,并且能够对外提供Discuz论坛服务。(10分)
在Web1、Web2服务器上搭建Tomcat 服务。(10分)
2)为nginx服务配置虚拟主机,新增两个域名 www.kgc.com 和 www.benet.com,使用http://www.kgc.com/index.php可访问上一题的Discuz论坛页面。(10分)
使用http://www.benet.com则访问/var/www/html目录中的index.html文件的内容,内容自定义。(10分)
3)对基于www.benet.com域名的虚拟机主机的nginx服务调优:隐藏nginx版本号,缓存静态图片网页时间为1天,设置防盗链功能。(10分)
4)网关服务器搭建NFS服务,提供的文件系统使用LVM类型,共享目录名称为/opt/nfs;要求根据日期对Discuz论坛服务的访问日志进行日志分割,要求每天生成一份日志文件,保存到NFS服务共享的目录内(10分)
5)要求配置location匹配请求地址http://www.kgc.com/test/XXXX,使用户访问该路径下的文件时返回/var/share/nginx/html/目录下的文件内容。(10分)
要求使用rewrite将使用域名www.benet.com 请求以 .php 结尾的访问都跳转到域名www.kgc.com上,而且后面的参数保持不变,比如访问http://www.benet.com/bbs/index.php跳转到http://www.kgc.com/bbs/index.php。(10分)
6)在Nginx服务器上对基于www.benet.com域名的虚拟机主机设置动静分离由nginx提供静态页面服务,将对 .jsp文件的动态页面请求转发到Tomcat 服务器处理,并实现负载均衡(10分)
7)在网关服务器上设置SNAT/DNAT,使client使用网关服务器的ens36接口的IP地址访问也可实现上一题的效果。(10分)