千家信息网

Web服务器群集之LAMP平台部署(LAMP架构搭建)

发表于:2025-12-04 作者:千家信息网编辑
千家信息网最后更新 2025年12月04日,Web服务器群集之LAMP平台部署(LAMP架构搭建)涉及:Linux/Centos7系统 Apache Mysql PHP一、前言​ 上一篇文章主要讲述了有关Web与HTTP协议的基础知识,有了这一
千家信息网最后更新 2025年12月04日Web服务器群集之LAMP平台部署(LAMP架构搭建)

Web服务器群集之LAMP平台部署(LAMP架构搭建)

涉及:Linux/Centos7系统 Apache Mysql PHP

一、前言

​ 上一篇文章主要讲述了有关Web与HTTP协议的基础知识,有了这一基础知识理论的奠定,将对我们此次搭建部署LAMP平台的实验有所帮助。

​ LAMP架构是非常成熟的企业网站应用模式之一,其指的是协同工作的一整套系统和相关软件,能够提供动态Web站点服务及其应用开发环境。LAMP是一个缩写词--Linux操作系统、Apache网站服务器、MySQL数据库服务器、PHP(或Perl、Python)网页编程语言。

下面我们通过具体实际操作流程来讲述整个LAMP架构的搭建过程。

二、LAMP架构搭建实际流程(文章最后含详细步骤与相关解释)

​ 一般来说首先安装好Linux操作系统,之前的文章中有关于安装Centos7的安装步骤,这里就不再过多赘述了。

​ 其次是安装Apache、MySQL以及PHP组件,最后使用论坛以测试该架构。下面具体阐述操作这些流程。

相关组件与压缩包资源:

链接:https://pan.baidu.com/s/1Q2hz5x85p_8JSnVe--Abtg
提取码:xfqf

资源组件如下:

[root@localhost LAMP-C7]# ls -lhtotal 63M-rw-r--r--. 1 root root 1.1M Dec 13 09:44 apr-1.6.2.tar.gz-rw-r--r--. 1 root root 553K Dec 13 09:44 apr-util-1.6.0.tar.gz-rw-r--r--. 1 root root 9.4M Dec 13 09:44 Discuz_X2.5_SC_UTF8.zip-rw-r--r--. 1 root root 6.3M Dec 13 09:44 httpd-2.4.29.tar.bz2-rw-r--r--. 1 root root  32M Dec 13 09:44 mysql-5.6.26.tar.gz-rw-r--r--. 1 root root  14M Dec 13 09:44 php-5.6.11.tar.bz2

2.1Apache组件手工编译安装流程

1.解压三个包

[root@localhost LAMP-C7]# tar zxf apr-1.6.2.tar.gz -C /opt/[root@localhost LAMP-C7]# tar zxf apr-util-1.6.0.tar.gz -C /opt/[root@localhost LAMP-C7]# tar jxf httpd-2.4.29.tar.bz2 -C /opt/[root@localhost LAMP-C7]# cd /opt/[root@localhost opt]# lsapr-1.6.2  apr-util-1.6.0  httpd-2.4.29  rh[root@localhost opt]# mv apr-1.6.2/ httpd-2.4.29/srclib/apr[root@localhost opt]# mv apr-util-1.6.0/ httpd-2.4.29/srclib/apr-util[root@localhost opt]# cd httpd-2.4.29/srclib/[root@localhost srclib]# lsapr  apr-util  Makefile.in[root@localhost srclib]# cd ..[root@localhost httpd-2.4.29]# lsABOUT_APACHE     BuildBin.dsp    emacs-style     LAYOUT        NOTICE            srclibacinclude.m4     buildconf       httpd.dep       libhttpd.dep  NWGNUmakefile     supportApache-apr2.dsw  CHANGES         httpd.dsp       libhttpd.dsp  os                testApache.dsw       CMakeLists.txt  httpd.mak       libhttpd.mak  README            VERSIONINGapache_probes.d  config.layout   httpd.spec      LICENSE       README.cmakeap.d             configure       include         Makefile.in   README.platformsbuild            configure.in    INSTALL         Makefile.win  ROADMAPBuildAll.dsp     docs            InstallBin.dsp  modules       server

2.安装所需环境包

[root@localhost httpd-2.4.29]# yum install -y gcc gcc-c++ make pcre-devel perl expat-develLoaded plugins: fastestmirror, langpacksbase                                                                           | 3.6 kB  00:00:00     extras                                                                         | 2.9 kB  00:00:00     updates                                                                        | 2.9 kB  00:00:00     (1/4): extras/7/x86_64/primary_db                                              | 153 kB  00:00:00     (2/4): base/7/x86_64/group_gz                                                  | 165 kB  00:00:00     (3/4): base/7/x86_64/primary_db                                                | 6.0 MB  00:00:12     (4/4): updates/7/x86_64/primary_db                                             | 5.8 MB  00:00:48     Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.ustc.edu.cn * updates: ftp.sjtu.edu.cnResolving Dependencies--> Running transaction check---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed......//省略部分内容Install  4 Packages (+6 Dependent packages)Upgrade  2 Packages (+6 Dependent packages)Total download size: 67 MDownloading packages:

3.参数配置

[root@localhost httpd-2.4.29]# ./configure \> --prefix=/usr/local/httpd \> --enable-so \> --enable-rewrite \> --enable-charset-lite \> --enable-cgi checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-pc-linux-gnu......//省略部分内容config.status: executing default commandsconfigure: summary of build options:    Server Version: 2.4.29    Install prefix: /usr/local/httpd    C compiler:     gcc -std=gnu99    CFLAGS:          -g -O2 -pthread      CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE      LDFLAGS:               LIBS:                 C preprocessor: gcc -E

4.编译与安装(等待时间稍长,mysql耗时更久,请务必耐心)

[root@localhost httpd-2.4.29]# make && make installMaking all in srclibmake[1]: Entering directory `/opt/httpd-2.4.29/srclib'Making all in aprmake[2]: Entering directory `/opt/httpd-2.4.29/srclib/apr'make[3]: Entering directory `/opt/httpd-2.4.29/srclib/apr'/opt/httpd-2.4.29/srclib/apr/build/mkdir.sh tools/bin/sh /opt/httpd-2.4.29/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread .......//省略部分内容mkdir /usr/local/httpd/manmkdir /usr/local/httpd/man/man1mkdir /usr/local/httpd/man/man8mkdir /usr/local/httpd/manualmake[1]: Leaving directory `/opt/httpd-2.4.29'[root@localhost httpd-2.4.29]# 

5.优化启动脚本路径与文件

[root@localhost ~]#  cd[root@localhost ~]#  cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd[root@localhost ~]#  vim /etc/init.d/httpd[root@localhost ~]#  head /etc/init.d/httpd#!/bin/sh# chkconfig: 35 85 21# description: Apache is a World Wide Web server## Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements.  See the NOTICE file distributed with# this work for additional information regarding copyright ownership.# The ASF licenses this file to You under the Apache License, Version 2.0# (the "License"); you may not use this file except in compliance with# the License.  You may obtain a copy of the License at[root@localhost ~]# chkconfig --add httpd[root@localhost ~]# 

6.主配置文件设置

[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf [root@localhost ~]# head -197 /usr/local/httpd/conf/httpd.conf  | tail -1ServerName www.lokott.com:80[root@localhost ~]# head -52 /usr/local/httpd/conf/httpd.conf  | tail -2Listen 192.168.68.132:80#Listen 80

7.优化配置文件路径(创建软链接)

[root@localhost ~]# ln -s /usr/local/httpd/conf/httpd.conf /etc/[root@localhost ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/

8.关闭防火墙和SELinux功能

[root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# setenforce 0

9.启动服务--service httpd start

10.测试验证服务是否开启成功

2.2MySQL组件手工编译安装流程

1.解压缩软件包并且安装环境包

[root@localhost LAMP-C7]# tar zxf mysql-5.6.26.tar.gz -C /opt/[root@localhost LAMP-C7]# cd /opt/mysql-5.6.26/[root@localhost mysql-5.6.26]# ls -lhtotal 668Kdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 BUILD-rw-r--r--.  1 7161 wheel  142 Jul 15  2015 BUILD-CMAKEdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 clientdrwxr-xr-x.  4 7161 wheel 4.0K Jul 15  2015 cmake-rw-r--r--.  1 7161 wheel  22K Jul 15  2015 CMakeLists.txtdrwxr-xr-x.  3 7161 wheel   21 Jul 15  2015 cmd-line-utils-rw-r--r--.  1 7161 wheel  20K Jul 15  2015 config.h.cmake-rw-r--r--.  1 7161 wheel  36K Jul 15  2015 configure.cmake-rw-r--r--.  1 7161 wheel  18K Jul 15  2015 COPYINGdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 dbugdrwxr-xr-x.  2 7161 wheel  102 Jul 15  2015 Docs-rw-r--r--.  1 7161 wheel  65K Jul 15  2015 Doxyfile-perfschemadrwxr-xr-x.  3 7161 wheel  212 Jul 15  2015 extradrwxr-xr-x.  4 7161 wheel 4.0K Jul 15  2015 include-rw-r--r--.  1 7161 wheel 393K Jul 15  2015 INSTALL-SOURCE-rw-r--r--.  1 7161 wheel  247 Jul 15  2015 INSTALL-WIN-SOURCEdrwxr-xr-x.  7 7161 wheel 4.0K Jul 15  2015 libeventdrwxr-xr-x.  3 7161 wheel  199 Jul 15  2015 libmysqldrwxr-xr-x.  3 7161 wheel  204 Jul 15  2015 libmysqlddrwxr-xr-x.  2 7161 wheel  221 Jul 15  2015 libservicesdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 mandrwxr-xr-x. 10 7161 wheel 4.0K Jul 15  2015 mysql-testdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 mysysdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 mysys_ssldrwxr-xr-x. 14 7161 wheel  207 Jul 15  2015 packagingdrwxr-xr-x.  9 7161 wheel  141 Jul 15  2015 plugin-rw-r--r--.  1 7161 wheel 2.5K Jul 15  2015 READMEdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 regexdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 scriptsdrwxr-xr-x.  4 7161 wheel  12K Jul 15  2015 sqldrwxr-xr-x.  5 7161 wheel 4.0K Jul 15  2015 sql-benchdrwxr-xr-x.  2 7161 wheel  125 Jul 15  2015 sql-commondrwxr-xr-x. 13 7161 wheel  169 Jul 15  2015 storagedrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 stringsdrwxr-xr-x.  5 7161 wheel 4.0K Jul 15  2015 support-filesdrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 testsdrwxr-xr-x.  5 7161 wheel  103 Jul 15  2015 unittest-rw-r--r--.  1 7161 wheel   88 Jul 15  2015 VERSIONdrwxr-xr-x.  3 7161 wheel 4.0K Jul 15  2015 viodrwxr-xr-x.  2 7161 wheel   32 Jul 15  2015 windrwxr-xr-x.  2 7161 wheel 4.0K Jul 15  2015 zlib[root@localhost mysql-5.6.26]# yum install ncurses-devel cmake autoconf -y......//省略部分内容

2.参数配置

[root@localhost mysql-5.6.26]# cmake \> -DCMKE_INSTALL_PREFIX=/usr/local/mysql \> -DDEFAULT_CHARSET=utf8 \> -DDEFAULT_COLLATION=utf8_general_ci \> -DEXTRA_CHARSETS=all \> -DSYSCONFIDIR=/etc \> -DMYSQL_DATADIR=/home/mysql \> -DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock......//省略部分内容-- Build files have been written to: /opt/mysql-5.6.26[root@localhost mysql-5.6.26]# 

3.编译与安装(时间较长,请耐心等待)

[root@localhost mysql-5.6.26]# make && make install......//省略部分内容-- Installing: /usr/local/mysql/sql-bench/innotest1a-- Installing: /usr/local/mysql/sql-bench/run-all-tests-- Installing: /usr/local/mysql/sql-bench/innotest2-- Installing: /usr/local/mysql/sql-bench/test-wisconsin-- Installing: /usr/local/mysql/sql-bench/compare-results-- Installing: /usr/local/mysql/sql-bench/bench-init.pl[root@localhost mysql-5.6.26]# 

4.优化处理

[root@localhost mysql-5.6.26]# lsBUILD                COPYING                  INSTALL-SOURCE      mysys_ssl         stringsBUILD-CMAKE          CPackConfig.cmake        INSTALL-WIN-SOURCE  packaging         support-filesclient               CPackSourceConfig.cmake  libevent            plugin            testscmake                CTestTestfile.cmake      libmysql            README            unittestCMakeCache.txt       dbug                     libmysqld           regex             VERSIONCMakeFiles           Docs                     libservices         scripts           VERSION.depcmake_install.cmake  Doxyfile-perfschema      make_dist.cmake     source_downloads  vioCMakeLists.txt       extra                    Makefile            sql               wincmd-line-utils       include                  man                 sql-bench         zlibconfig.h.cmake       info_macros.cmake        mysql-test          sql-commonconfigure.cmake      install_manifest.txt     mysys               storage[root@localhost mysql-5.6.26]# \cp support-files/my-default.cnf /etc/my.cnf[root@localhost mysql-5.6.26]# cp support-files/mysql.server /etc/init.d/mysqld[root@localhost mysql-5.6.26]# chmod 755 /etc/init.d/mysqld [root@localhost mysql-5.6.26]# chkconfig --add /etc/init.d/mysqld[root@localhost mysql-5.6.26]# chkconfig mysqld --level 235 on

5.优化命令环境变量

[root@localhost mysql-5.6.26]# echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile[root@localhost mysql-5.6.26]# source /etc/profile[root@localhost mysql-5.6.26]# echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin/

6.添加程序用户

[root@localhost mysql-5.6.26]# useradd -s /sbin/nologin mysql[root@localhost mysql-5.6.26]# chown -R mysql.mysql /usr/local/mysql/

7.初始化数据库

[root@localhost mysql-5.6.26]# /usr/local/mysql/scripts/mysql_install_db \> --user=mysql \> --ldata=/var/lib/mysql \> --basedir=/usr/local/mysql \> --datadir=/home/mysql.......//省略部分内容[root@localhost mysql-5.6.26]#

8.更改启动脚本并启动服务

[root@localhost mysql-5.6.26]# ln -s /var/lib/mysql/mysql.sock /home/mysql/mysql.sock[root@localhost mysql-5.6.26]# vim /etc/init.d/mysqld [root@localhost mysql-5.6.26]# head -47 /etc/init.d/mysqld |tail -2basedir=/usr/local/mysqldatadir=/home/mysql[root@localhost mysql-5.6.26]# service mysqld startStarting MySQL. SUCCESS! [root@localhost mysql-5.6.26]# netstat -natp | grep 3306tcp6       0      0 :::3306                 :::*                    LISTEN      80619/mysqld    

9.设置管理员密码

[root@localhost mysql-5.6.26]# mysqladmin -u root -p password "123456"Enter password: Warning: Using a password on the command line interface can be insecure.

10.进入数据库验证查看

[root@localhost mysql-5.6.26]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.26 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.00 sec)mysql> exitBye[root@localhost mysql-5.6.26]# 

2.3PHP组件手工编译安装流程

1.解压缩软件包并且安装所需环境

[root@localhost LAMP-C7]# tar jxf php-5.6.11.tar.bz2 -C /opt/[root@localhost LAMP-C7]# yum install -y gd libpng libpng-devel libjpeg-devel pcre libxml2-develLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.ustc.edu.cn * updates: ftp.sjtu.edu.cnPackage gd-2.0.35-26.el7.x86_64 already installed and latest versionPackage 2:libpng-1.5.13-7.el7_2.x86_64 already installed and latest versionPackage pcre-8.32-17.el7.x86_64 already installed and latest versionResolving Dependencies--> Running transaction check---> Package libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 will be installed.......//省略部分内容

2.参数配置设置

[root@localhost LAMP-C7]# cd /opt/php-5.6.11/[root@localhost php-5.6.11]# lsacinclude.m4      install-sh           README.EXT_SKEL                   sapiaclocal.m4        LICENSE              README.GIT-RULES                  scriptsbuild             ltmain.sh            README.input_filter               server-tests-config.phpbuildconf         main                 README.MAILINGLIST_RULES          server-tests.phpbuildconf.bat     makedist             README.md                         snapshotCODING_STANDARDS  Makefile.frag        README.namespaces                 stamp-h.inconfig.guess      Makefile.gcov        README.NEW-OUTPUT-API             stub.cconfig.sub        Makefile.global      README.PARAMETER_PARSING_API      testsconfigure         makerpm              README.REDIST.BINS                travisconfigure.in      missing              README.RELEASE_PROCESS            TSRMCREDITS           mkinstalldirs        README.SELF-CONTAINED-EXTENSIONS  UPGRADINGext               netware              README.STREAMS                    UPGRADING.INTERNALSEXTENSIONS        NEWS                 README.SUBMITTING_PATCH           vcscleanfooter            pear                 README.TESTING                    win32generated_lists   php5.spec.in         README.TESTING2                   Zendgenfiles          php.gif              README.UNIX-BUILD-SYSTEMheader            php.ini-development  README.WIN32-BUILD-SYSTEMINSTALL           php.ini-production   run-tests.php

3.编译与安装

[root@localhost php-5.6.11]# ./configure \> --prefix=/usr/local/php5 \> --with-gd \> --with-zlib \> --with-apxs2=/usr/local/httpd/bin/apxs \> --with-mysql=/usr/local/mysql \> --with-config-file-path=/usr/local/mysql \> --enable-mbstringchecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking for a sed that does not truncate output... /usr/bin/sedchecking build system type... x86_64-unknown-linux-gnu.....//省略部分内容

4.优化文件与更改主配置文件(PHP作为后端没有启动脚本,主要设置的是配置文件)

[root@localhost php-5.6.11]# make && make install.......//省略部分内容/opt/php-5.6.11/build/shtool install -c ext/phar/phar.phar /usr/local/php5/binln -s -f phar.phar /usr/local/php5/bin/pharInstalling PDO headers:          /usr/local/php5/include/php/ext/pdo/[root@localhost php-5.6.11]# 

5.将配置文件存放到指定的目录下并且优化命令(创建软链接)

[root@localhost php-5.6.11]# lsacinclude.m4      INSTALL             NEWS                              README.TESTING2aclocal.m4        install-sh          pear                              README.UNIX-BUILD-SYSTEMbuild             libphp5.la          php5.spec                         README.WIN32-BUILD-SYSTEMbuildconf         libs                php5.spec.in                      run-tests.phpbuildconf.bat     libtool             php.gif                           sapiCODING_STANDARDS  LICENSE             php.ini-development               scriptsconfig.guess      ltmain.sh           php.ini-production                server-tests-config.phpconfig.log        main                README.EXT_SKEL                   server-tests.phpconfig.nice       makedist            README.GIT-RULES                  snapshotconfig.status     Makefile            README.input_filter               stamp-h.inconfig.sub        Makefile.frag       README.MAILINGLIST_RULES          stub.cconfigure         Makefile.fragments  README.md                         testsconfigure.in      Makefile.gcov       README.namespaces                 travisCREDITS           Makefile.global     README.NEW-OUTPUT-API             TSRMext               Makefile.objects    README.PARAMETER_PARSING_API      UPGRADINGEXTENSIONS        makerpm             README.REDIST.BINS                UPGRADING.INTERNALSfooter            meta_ccld           README.RELEASE_PROCESS            vcscleangenerated_lists   missing             README.SELF-CONTAINED-EXTENSIONS  win32genfiles          mkinstalldirs       README.STREAMS                    Zendheader            modules             README.SUBMITTING_PATCHinclude           netware             README.TESTING[root@localhost php-5.6.11]# cp php.ini-development /usr/local/php5/php.ini[root@localhost php-5.6.11]# ln -s /usr/local/php5/bin/* /usr/local/bin/

6.配置主配置文件

[root@localhost php-5.6.11]# vim /etc/httpd.conf [root@localhost php-5.6.11]# head -256 /etc/httpd.conf |tail -1    DirectoryIndex index.html index.php[root@localhost php-5.6.11]# head -395 /etc/httpd.conf |tail -4    AddType application/x-compress .Z    AddType application/x-gzip .gz .tgz    AddType application/x-httpd-php .php      AddType application/x-httpd-php-source .phps[root@localhost php-5.6.11]# 

7.设置php文件并重启httpd服务

[root@localhost php-5.6.11]# cd /usr/local/httpd/htdocs/[root@localhost htdocs]# cp index.html index.php[root@localhost htdocs]# vim index.php [root@localhost htdocs]# cat index.php [root@localhost htdocs]# service httpd stop[root@localhost htdocs]# service httpd start

8.本地测试验证

2.4论坛搭建测试该架构

[root@localhost LAMP-C7]# lsapr-1.6.2.tar.gz       Discuz_X2.5_SC_UTF8.zip  mysql-5.6.26.tar.gzapr-util-1.6.0.tar.gz  httpd-2.4.29.tar.bz2     php-5.6.11.tar.bz2[root@localhost LAMP-C7]# 
[root@localhost LAMP-C7]# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.6.26 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database lokott;Query OK, 1 row affected (0.00 sec)mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || lokott             || mysql              || performance_schema || test               |+--------------------+5 rows in set (0.00 sec)mysql> grant all on lokott.* to 'myuser'@'%' identified by 'admin123';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> exitBye[root@localhost LAMP-C7]# 
[root@localhost LAMP-C7]# unzip Discuz_X2.5_SC_UTF8.zip -d /opt/....../省略部分内容[root@localhost proc]# cd /opt/[root@localhost opt]# lshttpd-2.4.29  mysql-5.6.26  php-5.6.11  readme  rh  upload  utility[root@localhost opt]# cd upload/[root@localhost upload]# cd ..[root@localhost opt]# lshttpd-2.4.29  mysql-5.6.26  php-5.6.11  readme  rh  upload  utility[root@localhost opt]# cp -r upload/ /usr/local/httpd/htdocs/lokott[root@localhost opt]# cd /usr/local/httpd/htdocs/[root@localhost htdocs]# lsindex.html  index.php  lokott[root@localhost htdocs]# cd lokott/[root@localhost lokott]# lsadmin.php  config           data         home.php    misc.php    search.php  uc_clientapi        connect.php      favicon.ico  index.php   plugin.php  source      uc_serverapi.php    cp.php           forum.php    install     portal.php  static      userapp.phparchiver   crossdomain.xml  group.php    member.php  robots.txt  template[root@localhost lokott]# 

此时发现状态都是不可写或者说目录不存在的,这是因为对应的文件目录的属主是root

[root@localhost lokott]# ls -ltotal 76-rw-r--r--.  1 root root 2603 Dec 13 12:20 admin.phpdrwxr-xr-x. 11 root root  163 Dec 13 12:20 api-rw-r--r--.  1 root root  727 Dec 13 12:20 api.phpdrwxr-xr-x.  2 root root   23 Dec 13 12:20 archiverdrwxr-xr-x.  2 root root   90 Dec 13 12:20 config-rw-r--r--.  1 root root  922 Dec 13 12:20 connect.php-rw-r--r--.  1 root root  253 Dec 13 12:20 cp.php-rw-r--r--.  1 root root  106 Dec 13 12:20 crossdomain.xmldrwxr-xr-x. 13 root root  216 Dec 13 12:20 data-rw-r--r--.  1 root root 5558 Dec 13 12:20 favicon.ico-rw-r--r--.  1 root root 2110 Dec 13 12:20 forum.php-rw-r--r--.  1 root root  823 Dec 13 12:20 group.php-rw-r--r--.  1 root root 1223 Dec 13 12:20 home.php-rw-r--r--.  1 root root 5448 Dec 13 12:20 index.phpdrwxr-xr-x.  5 root root   64 Dec 13 12:20 install-rw-r--r--.  1 root root 1040 Dec 13 12:20 member.php-rw-r--r--.  1 root root 1381 Dec 13 12:20 misc.php-rw-r--r--.  1 root root 1757 Dec 13 12:20 plugin.php-rw-r--r--.  1 root root  985 Dec 13 12:20 portal.php-rw-r--r--.  1 root root  582 Dec 13 12:20 robots.txt-rw-r--r--.  1 root root 1158 Dec 13 12:20 search.phpdrwxr-xr-x. 10 root root  168 Dec 13 12:20 sourcedrwxr-xr-x.  6 root root   72 Dec 13 12:20 staticdrwxr-xr-x.  3 root root   38 Dec 13 12:20 templatedrwxr-xr-x.  6 root root   92 Dec 13 12:20 uc_clientdrwxr-xr-x. 13 root root  241 Dec 13 12:20 uc_server-rw-r--r--.  1 root root 1691 Dec 13 12:20 userapp.php[root@localhost lokott]# chown -R daemon config/[root@localhost lokott]# chown -R daemon data/[root@localhost lokott]# chown -R daemon uc_client/[root@localhost lokott]# chown -R daemon uc_server/

0