首页 > 其他分享 >LAMP+WordPress

LAMP+WordPress

时间:2023-05-25 21:57:27浏览次数:66  
标签:httpd apr -- LAMP WordPress php root localhost

操作系统:Centos 8-Stream

IP:192.168.88.128,等下访问网页都是用这个IP访问

apache的服务和php服务采用源码安装的方式,mysql数据库采用yum安装mariadb的方式

安装配置apache服务

安装apr,apr-util,httpd

#下载wget,vim,gcc,gcc-c++,make工具和解析命令
[root@localhost ~]# dnf -y install vim make gcc gcc-c++ wget
  • 安装apr

    [root@localhost ~]#  wget https://archive.apache.org/dist/apr/apr-1.7.4.tar.gz
    
  • 安装apr-util

    [root@localhost ~]# wget https://archive.apache.org/dist/apr/apr-util-1.6.3.tar.gz
    
  • 安装httpd

    [root@localhost ~]# wget https://archive.apache.org/dist/httpd/httpd-2.4.57.tar.gz
    

解压安装包

[root@localhost ~]# tar xf apr-1.7.4.tar.gz 
[root@localhost ~]# tar xf apr-util-1.6.3.tar.gz 
[root@localhost ~]# tar xf httpd-2.4.57.tar.gz 
[root@localhost ~]# ls
anaconda-ks.cfg   apr-util-1.6.3         httpd-2.4.57.tar.gz
apr-1.7.4         apr-util-1.6.3.tar.gz  apr-1.7.4.tar.gz  httpd-2.4.57

安装所需包

[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool

安装apr,执行configure脚本,make,make install命令

#进入apr解压目录
[root@localhost ~]# cd apr-1.7.4
[root@localhost apr-1.7.4]# ls
apr-config.in     CMakeLists.txt  libapr.mak     poll
apr.dep           config.layout   libapr.rc      random
apr.dsp           configure       LICENSE        README
apr.dsw           configure.in    locks          README.cmake
apr.mak           docs            Makefile.in    shmem
apr.pc.in         dso             Makefile.win   strings
apr.spec          emacs-mode      memory         support
atomic            encoding        misc           tables
build             file_io         mmap           test
build.conf        helpers         network_io     threadproc
buildconf         include         NOTICE         time
build-outputs.mk  libapr.dep      NWGNUmakefile  tools
CHANGES           libapr.dsp      passwd         user

#安装到/usr/local目录下面,先配置configure
[root@localhost apr-1.7.4]# vim configure

    cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
    $RM "$cfgfile"				#删除这一行或者注释
    
[root@localhost apr-1.7.4]# ./configure --prefix=/usr/local/apr  
#不出现报错信息即为成功

[root@localhost apr-1.7.4]# ls
apr-1-config   build             configure     libapr.dsp    misc           shmem
apr-config.in  build.conf        configure.in  libapr.mak    mmap           strings
apr.dep        buildconf         docs          libapr.rc     network_io     support
apr.dsp        build-outputs.mk  dso           libtool       NOTICE         tables
apr.dsw        CHANGES           emacs-mode    LICENSE       NWGNUmakefile  test
apr.mak        CMakeLists.txt    encoding      locks         passwd         threadproc
apr.pc         config.layout     file_io       Makefile      poll           time
apr.pc.in      config.log        helpers       Makefile.in   random         tools
apr.spec       config.nice       include       Makefile.win  README         user
atomic         config.status     libapr.dep    memory        README.cmake

#该命令执行完目录下生成Makefile文件,make解析,make install命令安装
[root@localhost apr-1.7.4]# make && make install
#不出现报错信息即为成功

#查看目录
[root@localhost apr-1.7.4]# ll /usr/local/
total 0
drwxr-xr-x  6 root root 58 May 25 14:31 apr
drwxr-xr-x. 2 root root  6 Jun 22  2021 bin
drwxr-xr-x. 2 root root  6 Jun 22  2021 etc
drwxr-xr-x. 2 root root  6 Jun 22  2021 games
drwxr-xr-x. 2 root root  6 Jun 22  2021 include
drwxr-xr-x. 2 root root  6 Jun 22  2021 lib
drwxr-xr-x. 3 root root 17 May 24 22:03 lib64
drwxr-xr-x. 2 root root  6 Jun 22  2021 libexec
drwxr-xr-x. 2 root root  6 Jun 22  2021 sbin
drwxr-xr-x. 5 root root 49 May 24 22:03 share
drwxr-xr-x. 2 root root  6 Jun 22  2021 src

安装apr-util

#需要注意,这里要指定apr的目录路径
[root@localhost ~]# cd apr-util-1.6.3
[root@localhost apr-util-1.6.3]# ls
aprutil.dep     buildconf         docs               LICENSE         redis
aprutil.dsp     build-outputs.mk  encoding           Makefile.in     renames_pending
aprutil.dsw     CHANGES           export_vars.sh.in  Makefile.win    strmatch
aprutil.mak     CMakeLists.txt    hooks              memcache        test
apr-util.pc.in  config.layout     include            misc            uri
apr-util.spec   configure         ldap               NOTICE          xlate
apu-config.in   configure.in      libaprutil.dep     NWGNUmakefile   xml
buckets         crypto            libaprutil.dsp     README
build           dbd               libaprutil.mak     README.cmake
build.conf      dbm               libaprutil.rc      README.FREETDS

[root@localhost apr-util-1.6.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
#不出现报错信息即为成功

[root@localhost apr-util-1.6.3]# ls
aprutil.dep     build.conf        crypto             libaprutil.dsp  README
aprutil.dsp     buildconf         dbd                libaprutil.mak  README.cmake
aprutil.dsw     build-outputs.mk  dbm                libaprutil.rc   README.FREETDS
aprutil.mak     CHANGES           docs               LICENSE         redis
apr-util.pc     CMakeLists.txt    encoding           Makefile        renames_pending
apr-util.pc.in  config.layout     export_vars.sh     Makefile.in     strmatch
apr-util.spec   config.log        export_vars.sh.in  Makefile.win    test
apu-1-config    config.nice       hooks              memcache        uri
apu-config.in   config.status     include            misc            xlate
buckets         configure         ldap               NOTICE          xml
build           configure.in      libaprutil.dep     NWGNUmakefile

#执行make解析,make install安装
[root@localhost apr-util-1.6.3]# make && make install
#不出现报错信息即为成功

#查看目录
[root@localhost apr-util-1.6.3]# ll /usr/local/
total 0
drwxr-xr-x  6 root root 58 May 25 14:31 apr
drwxr-xr-x  5 root root 43 May 25 14:36 apr-util
drwxr-xr-x. 2 root root  6 Jun 22  2021 bin
drwxr-xr-x. 2 root root  6 Jun 22  2021 etc
drwxr-xr-x. 2 root root  6 Jun 22  2021 games
drwxr-xr-x. 2 root root  6 Jun 22  2021 include
drwxr-xr-x. 2 root root  6 Jun 22  2021 lib
drwxr-xr-x. 3 root root 17 May 24 22:03 lib64
drwxr-xr-x. 2 root root  6 Jun 22  2021 libexec
drwxr-xr-x. 2 root root  6 Jun 22  2021 sbin
drwxr-xr-x. 5 root root 49 May 24 22:03 share
drwxr-xr-x. 2 root root  6 Jun 22  2021 src

安装httpd

[root@localhost ~]# cd httpd-2.4.57
[root@localhost httpd-2.4.57]# ls
ABOUT_APACHE     CHANGES          httpd.mak       Makefile.in       ROADMAP
acinclude.m4     changes-entries  httpd.spec      Makefile.win      server
Apache-apr2.dsw  CMakeLists.txt   include         modules           srclib
Apache.dsw       config.layout    INSTALL         NOTICE            support
apache_probes.d  configure        InstallBin.dsp  NWGNUmakefile     test
ap.d             configure.in     LAYOUT          os                VERSIONING
build            docs             libhttpd.dep    README
BuildAll.dsp     emacs-style      libhttpd.dsp    README.CHANGES
BuildBin.dsp     httpd.dep        libhttpd.mak    README.cmake
buildconf        httpd.dsp        LICENSE         README.platforms

#注意选项过多,不要敲错了
[root@localhost httpd-2.4.57]# ./configure --prefix=/usr/local/apache \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--with-apr=/usr/local/apr/ \
--with-apr-util=/usr/local/apr-util/ \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork
#不出现报错信息即为成功

#执行make解析,make install安装
[root@localhost httpd-2.4.57]# make && make install
#不出现报错信息即为成功

#查看目录
[root@localhost httpd-2.4.57]# ll /usr/local/
total 0
drwxr-xr-x  14 root root 164 May 25 14:43 apache
drwxr-xr-x   6 root root  58 May 25 14:31 apr
drwxr-xr-x   5 root root  43 May 25 14:36 apr-util
drwxr-xr-x.  2 root root   6 Jun 22  2021 bin
drwxr-xr-x.  2 root root   6 Jun 22  2021 etc
drwxr-xr-x.  2 root root   6 Jun 22  2021 games
drwxr-xr-x.  2 root root   6 Jun 22  2021 include
drwxr-xr-x.  2 root root   6 Jun 22  2021 lib
drwxr-xr-x.  3 root root  17 May 24 22:03 lib64
drwxr-xr-x.  2 root root   6 Jun 22  2021 libexec
drwxr-xr-x.  2 root root   6 Jun 22  2021 sbin
drwxr-xr-x.  5 root root  49 May 24 22:03 share
drwxr-xr-x.  2 root root   6 Jun 22  2021 src
  • 配置apache环境变量,创建链接文件

    [root@localhost httpd-2.4.57]# vi /etc/profile.d/httpd.sh
    export PATH=/usr/local/apache/bin:$PATH
    [root@localhost httpd-2.4.57]# source /etc/profile.d/httpd.sh 
    [root@localhost httpd-2.4.57]# echo $PATH
    /usr/local/apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
    [root@localhost httpd-2.4.57]# 
    
    #创建链接
    [root@localhost httpd-2.4.57]# ln -s /usr/local/apache/include /usr/local/include/httpd
    
  • 修改apache配置文件,开启httpd服务

    [root@localhost ~]# cd /usr/local/apache/
    [root@localhost apache]# ls
    bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
    [root@localhost apache]# cd conf/
    [root@localhost conf]# ls
    extra  httpd.conf  magic  mime.types  original
    [root@localhost conf]# vim httpd.conf 
    
     ServerName www.example.com:80	   #去掉注释,这一行在203,命令模式set nu可显示行号
     
     #启动服务
     [root@localhost ~]# apachectl start
    [root@localhost ~]# ss -antl
    State     Recv-Q    Send-Q        Local Address:Port         Peer Address:Port    Process    
    LISTEN    0         128                 0.0.0.0:22                0.0.0.0:*                  
    LISTEN    0         511                       *:80                      *:*                  
    LISTEN    0         128                    [::]:22                   [::]:*    
    
    #80端口已经开启
    
  • 检查防火墙和selinux

    [root@localhost ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabl>
       Active: inactive (dead)
         Docs: man:firewalld(1)
    [root@localhost ~]# getenforce 
    Disabled
    
    #如果未关闭,以下命令关闭
    [root@localhost ~]# systemctl disable --now firewalld
    
    [root@localhost ~]# vi /etc/selinux/config 
    
    SELINUX=disabled
    
  • apache网页文件在/usr/local/apache/htdocs里面,浏览网页

it work

安装配置mariadb数据库服务

安装mariadb

[root@localhost ~]# yum -y install mariadb*

启动mariadb并设置开机自启动

[root@localhost ~]# systemctl enable --now mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

设置密码

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> set password = password('Password@123!');
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> quit
Bye

测试新密码登录mysql

[root@localhost ~]# mysql -uroot -pPassword@123!
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> quit
Bye

安装配置php

配置yum源

[root@localhost ~]# wget http://rpms.remirepo.net/enterprise/remi-release-8.rpm
--2023-05-25 15:03:18--  http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Resolving rpms.remirepo.net (rpms.remirepo.net)... 109.238.14.107, 2a00:c70:1:109:238:14:107:1
Connecting to rpms.remirepo.net (rpms.remirepo.net)|109.238.14.107|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 32220 (31K) [application/x-rpm]
Saving to: ‘remi-release-8.rpm’

remi-release-8.rpm      100%[============================>]  31.46K   166KB/s    in 0.2s    

2023-05-25 15:03:19 (166 KB/s) - ‘remi-release-8.rpm’ saved [32220/32220]

#更新,如果报错安装epel-release源
[root@localhost ~]# rpm -Uvh remi-release-8.rpm
warning: remi-release-8.rpm: Header V4 RSA/SHA256 Signature, key ID 5f11735a: NOKEY
error: Failed dependencies:
	epel-release = 8 is needed by remi-release-8.7-2.el8.remi.noarch

#再次更新
[root@localhost ~]# rpm -Uvh remi-release-8.rpm
warning: remi-release-8.rpm: Header V4 RSA/SHA256 Signature, key ID 5f11735a: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:remi-release-8.7-2.el8.remi      ################################# [100%]
   
#查看/etc/yum.repos.d/
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Stream-AppStream.repo         CentOS-Stream-ResilientStorage.repo
CentOS-Stream-BaseOS.repo            CentOS-Stream-Sources.repo
CentOS-Stream-Debuginfo.repo         epel-modular.repo
CentOS-Stream-Extras-common.repo     epel-playground.repo
CentOS-Stream-Extras.repo            epel.repo
CentOS-Stream-HighAvailability.repo  epel-testing-modular.repo
CentOS-Stream-Media.repo             epel-testing.repo
CentOS-Stream-NFV.repo               remi-modular.repo
CentOS-Stream-PowerTools.repo        remi.repo
CentOS-Stream-RealTime.repo          remi-safe.repo

清除缓存,建立缓存

[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache

安装依赖包

#过滤php-mysqlnd包
[root@localhost ~]# dnf search php-mysqlnd
Last metadata expiration check: 0:01:10 ago on Thu 25 May 2023 03:11:03 PM CST.
============================= Name Exactly Matched: php-mysqlnd =============================
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
================================= Name Matched: php-mysqlnd =================================
php56-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php70-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php71-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php72-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php73-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php74-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php80-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php81-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php82-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases

#由于是centos 8系统,安装这里装php-82-php-mysqlnd包
[root@localhost ~]# yum -y install libxml2 libxml2-devel \
openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel \
libicu-devel libjpeg libjpeg-devel libpng libpng-devel \
openldap-devel  pcre-devel freetype freetype-devel gmp \
gmp-devel libmcrypt libmcrypt-devel readline readline-devel \
libxslt libxslt-devel mhash \
mhash-devel php82-php-mysqlnd

下载php

[root@localhost ~]# wget http://cn.php.net/distributions/php-8.2.6.tar.xz

解压php包

[root@localhost ~]# tar xf php-8.2.6.tar.gz 

编译安装php

#需要额外安装源和三个包
[root@localhost php-8.2.6]# yum install -y http://rpms.remirepo.net/enterprise/7/ \
remi/x86_64//oniguruma5php-6.9.8-1.el7.remi.x86_64.rpm

[root@localhost php-8.2.6]# yum install -y http://rpms.remirepo.net/enterprise/7/ \
remi/x86_64//oniguruma5php-devel-6.9.8-1.el7.remi.x86_64.rpm

[root@localhost php-8.2.6]# yum install sqlite-devel


[root@localhost php-8.2.6]# ./configure --prefix=/usr/local/php8 \
--with-config-file-path=/etc --enable-fpm --enable-inline-optimization \
--disable-debug --disable-rpath --enable-shared --enable-soap \
--with-openssl --enable-bcmath --with-iconv --with-bz2 --enable-calendar \
--with-curl --enable-exif  --enable-ftp --with-gd --with-jpeg-dir \
--with-png-dir --with-zlib-dir --with-freetype-dir --with-gettext \
--enable-json --enable-mbstring --enable-pdo --with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd --with-readline --enable-shmop --enable-simplexml \
--enable-sockets --enable-zip --enable-mysqlnd-compression-support \
--with-pear --enable-pcntl --enable-posix

#make编译,make install安装
[root@localhost php-8.2.6]# make && make install
#不出现报错信息即为成功

配置环境变量

[root@localhost php-8.2.6]# echo 'export PATH=/usr/local/php8/bin:$PATH' > /etc/profile.d/php8.sh
[root@localhost php-8.2.6]# source /etc/profile.d/php8.sh 
[root@localhost php-8.2.6]# echo $PATH
/usr/local/php8/bin:/usr/local/apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

#查看版本信息
[root@localhost php-8.2.6]# php -version
PHP 8.2.6 (cli) (built: May 25 2023 15:27:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.6, Copyright (c) Zend Technologies

配置php-fpm

[root@localhost ~]# cd php-8.2.6/sapi/fpm/
[root@localhost fpm]# ls
config.m4       init.d.php-fpm.in  php-fpm.8        php-fpm.service     tests
CREDITS         LICENSE            php-fpm.8.in     php-fpm.service.in  www.conf
fpm             Makefile.frag      php-fpm.conf     status.html         www.conf.in
init.d.php-fpm  php-fpm            php-fpm.conf.in  status.html.in

[root@localhost fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@localhost fpm]# ll /etc/init.d/php-fpm 
-rw-r--r-- 1 root root 2402 May 25 15:30 /etc/init.d/php-fpm

#赋予php-fpm执行权限
[root@localhost fpm]# chmod +x /etc/init.d/php-fpm 
[root@localhost fpm]# ll /etc/init.d/php-fpm 
-rwxr-xr-x 1 root root 2402 May 25 15:30 /etc/init.d/php-fpm

[root@localhost php-8.2.6]# cd /usr/local/php8/etc/
[root@localhost etc]# ls
pear.conf  php-fpm.conf.default  php-fpm.d

[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# ls
pear.conf  php-fpm.conf  php-fpm.conf.default  php-fpm.d

[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# ls
www.conf.default
[root@localhost php-fpm.d]# cp www.conf.default www.conf
[root@localhost php-fpm.d]# ls
www.conf  www.conf.default

启动php

[root@localhost ~]# service php-fpm start
Starting php-fpm  done
[root@localhost ~]# ss -antlup
Netid    State     Recv-Q     Send-Q         Local Address:Port         Peer Address:Port    Process                                                                                      
tcp      LISTEN    0          2048               127.0.0.1:9000              0.0.0.0:*        users:(("php-fpm",pid=183480,fd=5),("php-fpm",pid=183479,fd=5),("php-fpm",pid=183478,fd=7)) 
tcp      LISTEN    0          80                   0.0.0.0:3306              0.0.0.0:*        users:(("mysqld",pid=52138,fd=21))                                                          
tcp      LISTEN    0          128                  0.0.0.0:22                0.0.0.0:*        users:(("sshd",pid=1065,fd=3))                                                              
tcp      LISTEN    0          511                        *:80                      *:*        users:(("httpd",pid=48872,fd=4),("httpd",pid=48863,fd=4),("httpd",pid=48862,fd=4),("httpd",pid=48861,fd=4),("httpd",pid=48860,fd=4),("httpd",pid=48859,fd=4),("httpd",pid=48858,fd=4))
tcp      LISTEN    0          128                     [::]:22                   [::]:*        users:(("sshd",pid=1065,fd=4))     

#9000端口已开启

启用httpd的相关模块

[root@localhost ~]# cd /usr/local/apache/conf/
[root@localhost conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@localhost conf]# vim httpd.conf 

#去掉下面两行的注释
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

配置虚拟主机

[root@localhost ~]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# ls
index.html

#创建站点文件夹rainmom(雨妈)
[root@localhost htdocs]# mkdir rainmom
[root@localhost htdocs]# cd rainmom/
[root@localhost rainmom]# ls
[root@localhost rainmom]# vi index.php
<?php
        phpinfo();
?>

#创建apache用户,配置权限所属
[root@localhost ~]# useradd -r -M -s /sbin/nologin apache
[root@localhost ~]# chown -R apache.apache /usr/local/apache/

[root@localhost ~]# vim /usr/local/apache/conf/httpd.conf 
#在配置文件的最后加入以下内容
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/rainmom"
    ServerName www.rainmom.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/rainmom/$1
    <Directory "/usr/local/apache/htdocs/rainmom">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>

#搜索AddType,添加以下内容
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    
#搜索IfModule dir_module,加一句'index.php'
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

重启apache服务,并验证

[root@localhost ~]# apachectl stop
[root@localhost ~]# apachectl start
[root@localhost ~]# ss -antlup
Netid    State     Recv-Q     Send-Q         Local Address:Port         Peer Address:Port    Process                                                                                      
tcp      LISTEN    0          2048               127.0.0.1:9000              0.0.0.0:*        users:(("php-fpm",pid=183480,fd=5),("php-fpm",pid=183479,fd=5),("php-fpm",pid=183478,fd=7)) 
tcp      LISTEN    0          80                   0.0.0.0:3306              0.0.0.0:*        users:(("mysqld",pid=52138,fd=21))                                                          
tcp      LISTEN    0          128                  0.0.0.0:22                0.0.0.0:*        users:(("sshd",pid=1065,fd=3))                                                              
tcp      LISTEN    0          511                        *:80                      *:*        users:(("httpd",pid=183541,fd=4),("httpd",pid=183540,fd=4),("httpd",pid=183539,fd=4),("httpd",pid=183538,fd=4),("httpd",pid=183537,fd=4),("httpd",pid=183536,fd=4))
tcp      LISTEN    0          128                     [::]:22                   [::]:*        users:(("sshd",pid=1065,fd=4))      

查看网页

iphp

注意:若是页面没有刷新,则重启php服务

[root@localhost ~]# service php-fpm stop
Gracefully shutting down php-fpm . done
[root@localhost ~]# service php-fpm start
Starting php-fpm  done

Wordpress个人博客系统

创建网站数据库

[root@localhost ~]# mysql -uroot -pPassword@123!
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> quit
Bye

#创建wordpress数据库

下载上传wordpress安装包,安装unzip命令

wordpress官方最新版下载地址:https://wordpress.org/download/

[root@localhost ~]# yum -y install unzip
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.57.tar.gz  php-8.2.6.tar.gz
apr-1.7.4        apr-util-1.6.3    httpd-2.4.57           php-8.2.6            wordpress-6.2.2.zip

删除原来站点创建的index.php文件

[root@localhost ~]# rm -rf /usr/local/apache/htdocs/rainmom/index.php

将wordpress包解压到站点rainmom目录下

[root@localhost ~]# unzip -d /usr/local/apache/htdocs/rainmom/ wordpress-6.2.2.zip

配置wp-config.sample.php

#复制一份,配置wp-config.php
[root@localhost ~]# cd /usr/local/apache/htdocs/rainmom
[root@localhost rainmom]# ls
index.php        wp-admin              wp-config-sample.php  wp-links-opml.php  wp-settings.php
license.txt      wp-blog-header.php    wp-content            wp-load.php        wp-signup.php
readme.html      wp-comments-post.php  wp-cron.php           wp-login.php       wp-trackback.php
wp-activate.php  wp-includes           wp-mail.php        xmlrpc.php

[root@localhost rainmom]# cp wp-config-sample.php wp-config.php 
[root@localhost rainmom]# vim wp-config.php 

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );			#修改数据库名称

/** Database username */
define( 'DB_USER', 'root' );				#修改数据库用户

/** Database password */
define( 'DB_PASSWORD', '111111' );			#修改数据库密码

/** Database hostname */
define( 'DB_HOST', '127.0.0.1' );			#修改数据库主机名

配置权限

[root@localhost ~]# chmod -R 777 /usr/local/apache/
[root@localhost ~]# chown -R apache.apache /usr/local/apache/

重启apache服务和php-fpm

[root@localhost ~]# apachectl restart
[root@localhost ~]# service php-fpm restart

访问wordpress

wordpress

标签:httpd,apr,--,LAMP,WordPress,php,root,localhost
From: https://www.cnblogs.com/skyrainmom/p/17432986.html

相关文章

  • 配置wordpress:图片太小太模糊(wordpress 6.2)
    一,图片上传或复制到wordpress后会变模糊原图清晰度:复制到wordpress后的清晰度:二,设置图片大小:把最大宽度和最大高度调整为2048配置后重新上传图片,清晰度提升说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest     对......
  • wordpress插件:用YARPP显示相关文章(wordpress 6.2)
    一,安装插件:插件->安装插件->搜索:RelatedPosts安装后可以进行配置二,测试效果说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest     对应的源码可以访问这里获取: https://github.com/liuhongdi/     或: https:......
  • HTB ACADEMY-Hacking WordPress WRITE UP
    YouhavebeencontractedtoperformanexternalpenetrationtestagainstthecompanyINLANEFREIGHTthatishostingoneoftheirmainpublic-facingwebsitesonWordPress.Enumeratethetargetthoroughlyusingtheskillslearnedinthismoduletofindavar......
  • wordpress部署
    wordpress部署1,拉取镜像dockerpull192.168.100.10/library/wordpressdockerpull192.168.100.10/library/mysql:5.62,编写compose文件mkdir/root/wordpressvimdocker-compose.yamlversion:'3.3'services:wordprss:image:192.168.100.1......
  • Wordpress自定义小工具(Widget)简单案例
    在主题对应目录创建文件如widgets.php<?php//继承了WP_Widget这个类来创建新的小工具(Widget):可在后台外观-小工具中添加此自定义小工具到页面具体位置classmy_widgetextendsWP_Widget{publicfunction__construct() { //$widget_ops可以给小工具进......
  • Django后台 + Wordpress主题,只要自己看上的主题都可以让它变成自己的
    既然学习了PythonWeb怎么能没有自己的一个小站呢?没有自己精心打造的一个小站怎么敢说自己学习过PythonWeb呢?说的再多不如直接干,我的个人网站也已经部署上线。Django后台+Wordpress主题,只要自己看上的主题都可以让它变成自己的为什么要选择Wordpress主题呢?自己在刚开始学习P......
  • 配置wordpress:自定义简码(wordpress 6.2)
    一,添加php代码的例子:1,代码://说明:得到当前时间functionlhdGetNowTime(){ $now=date("Y-m-dH:i:s");return$now;}//注册成简码,名字myNowadd_shortcode('myNow','lhdGetNowTime');//说明:获取完整URLfunctioncurPageURL(){ $pageURL='h......
  • 配置wordpress:在footer/页脚添加icp备案许可证号(wordpress 6.2)
    一,添加icp许可证号外观->主题文件编辑器->主题页脚:在class名为site-info的div中添加如下html代码:<div style="text-align:center"> <ahref="http://beian.miit.gov.cn/"class="imprint"rel="externalnofollow"target="_blank"......
  • CentOS 7 安装 WordPress
    参考0:https://blog.csdn.net/abcd5711664321/article/details/122554412参考1:https://www.yii666.com/article/551970.html参考2:https://www.cnblogs.com/yanans/p/12945001.html  修改文件/etc/httpd/conf/httpd.conf(一行不改也可以) 一行不改,原来是这样的   ......
  • wordpress 优化备份还原插件duplicator-pro-4_5_3_2的使用填坑
     创建备份我这边没有出错,就不说了 插件下载地址:https://www.wpjzb.com/wp-plugins/duplicator-pro/我是应的是  https://pan.baidu.com/share/init?surl=YRss-vqBVY2Twv1tBid9fQ   提取码:ibnshttps://pan.baidu.com/share/init?surl=6VSX3FUlugtfBfTPj4wLbg 提取......