操作系统:Centos 8-Stream
IP:192.168.88.128,等下访问网页都是用这个IP访问
apache的服务和php服务采用源码安装的方式,mysql数据库采用yum安装mariadb的方式
#下载wget,vim,gcc,gcc-c++,make工具和解析命令
[root@localhost ~]# dnf -y install vim make gcc gcc-c++ wget
安装apr
[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-1.7.4.tar.gz
安装apr-util
[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-util-1.6.3.tar.gz
安装httpd
[root@localhost ~]# wget http://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解压目录
[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的目录路径
[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
[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里面,浏览网页
[root@localhost ~]# yum -y install 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
[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
[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
[root@localhost ~]# wget http://cn.php.net/distributions/php-8.2.6.tar.xz
[root@localhost ~]# tar xf php-8.2.6.tar.gz
#需要额外安装源和三个包
[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
[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
[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端口已开启
[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>
[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))
注意:若是页面没有刷新,则重启php服务
[root@localhost ~]# service php-fpm stop
Gracefully shutting down php-fpm . done
[root@localhost ~]# service php-fpm start
Starting php-fpm done
[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官方最新版下载地址:http://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
[root@localhost ~]# rm -rf /usr/local/apache/htdocs/rainmom/index.php
[root@localhost ~]# unzip -d /usr/local/apache/htdocs/rainmom/ wordpress-6.2.2.zip
#复制一份,配置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/
[root@localhost ~]# apachectl restart
[root@localhost ~]# service php-fpm restart
一、前言前段时间有小伙伴问到如何用Unity制作天气预报,博主也是在网上找了很多资料,发现天气API接口稳定的确实没有,除非是天气官方提供的,但是我观察了下,要是合作伙伴才有开放的可能。其他的,例如:百度APIStore、一些同学在其他网站上抓包下来的接口,以及什么各种收费的API,都没有稳定的。找了很多接口API,发现了一个比较好用的免费天气API,就分享一下首先看一下效果图:项目源码链接:https://github.com/764424567/Unity_GetWeatherInfo二、参考资料1、unity获取地方位置和天气(简单版本)2、免费、稳定的天气预报API3、免费天气API,天气JSONAPI,不限次数获取十五天的天气预报4、国内天气APIJava版本请求Demo三、正文3.1获取地方位置百度地图API:http://api.map.baidu.com/location/ip?ak=bretF4dm6W5gqjQAXuvP0NXW6FeesRXb&coor=bd09ll 返回的Json字符串:{"address":"CN|\u6c
腾讯云对象存储COS为客户提供了99.95%的可用性和99.999999999%的可靠性。由此可见,数据可靠性是极高的,即使在极端故障场景下,也可以保证客户的数据不丢失。但实际线上系统更常遇见的是,因为网络拥塞、程序异常等原因,而导致的COS服务不可用,如对象读写失败,API调用异常等。当这些故障发生时,如果没有合适的冗余措施,即使存量数据不丢失,也会造成一段时间线上服务有损,影响用户使用体验。本文会结合一些客户的实际案例介绍一种COS服务的高可用方案。基于存储桶复制的高可用方案该方案的详细实现可参考腾讯云官网文档:https://cloud.tencent.com/document/product/436/37709。其架构示意图可见下图:该方案的核心是基于存储桶的异地复制,来实现数据的全备份。但是作为主备切换的高可用层,需要用户业务侧自己实现。腾讯云侧也给出了其中一个解决方案,通过腾讯云云云函数SCF,来实现主备存储桶的定时拨测和邮件告警,在主存储桶宕机不可用的时候,有业务侧程序实现切换读写存储桶。这个方案的优点在于除了可以使用腾讯云COS产品实现容灾冗余,还可以接入自有源站或其他
近期在存储服务。遇到了一个棘手的问题,电脑端,包括了Android的浏览器,应用都能正常的播放上传的mp4应用,但是链接一到苹果上就有问题了。搜了网上很快发现了问题。是因为苹果的要求很奇葩。苹果会发两次请求,第一次请求是不带Range的,这一波是只能返回Content-Length的,不能返回Content-Range以及其他的。第二波是需要根据苹果的请求的Range来返回Range的内的数据,然后状态码要设置为206,才不会出问题。另外。在ContentType上也有问题,就是如果你的mp4的Content-Type设置为video/mpeg4也是不行的,也只能是video/mp4才可以访问。重点已经讲完,下面是研究完成粗写的代码。部分方法你们是没有的,请不要照抄,请根据修改。publicvoidreadAndFlush(StringfileContentType,Filefile,HttpServletResponseresponse,StringfileId,booleanneedCache,StringfileName,Stringrange)throwsUploadExcep
老板出差,找人代看店咯今天,老板出差了,临时找了个技艺精湛的师傅帮他看店。 但是,老板有一个要求,一切流程,必须按照他定下来的规则走,烤面包,必须以他的方式来烤,烤肉,也必须以他的方式来,奶油怎么挤、生菜要多大等等都必须按照他的来,以确保顾客吃了之后没有啥反感。那我们来看一下这个事件中的主要因素:代工师傅、老板、老板的流程,生产出产品。 将这些因素用类图的形式来表述就是如此: 代码实现#include<iostream> usingnamespacestd; //抽象主题 classabstractMan{ public: virtualvoidrun()=0; }; classboss:publicabstractMan{ public: voidbread(){cout<<"bread"<<endl;} voidroast(){cout<<"roust"<<endl;} voidrun(){ //暂时不插其他模式,后面会有组合模式 bread(); ro
进程的创建-multiprocessingmultiprocessing模块就是跨平台版本的多进程模块,提供了一个Process类来代表一个进程对象,这个对象可以理解为是一个独立的进程,可以执行另外的事情2个while循环一起执行,同时两人循环买烟[root@server01process]#vimtest.py #-*-coding:utf-8-*- frommultiprocessingimportProcess importtime defbug_ciggite(): whileTrue: print("第一个人:胖子老板来包蓝利群") time.sleep(1) defmain(): #第一个人开启一个子进程来执行循环买烟的操作 p=Process(target=bug_ciggite) p.start() #第二个人来跟胖子老板买烟 whileTrue: print("第二个人:胖子老板来包芙蓉王") time.sleep(1) if__name__=="__main__": main()复制执行如下:[
文章转载自:大鱼AI作者:武博士、宋知达、袁雪瑶、聂文韬一、人类的大脑人之所以主宰地球,主要还是靠人类的智慧。智慧在什么地方?智慧在大脑中。至今为止,我们仍然没有完全了解人类的大脑是如何运作的。由目前我们的认知来看,大脑本身并非一开始就有惊人的记忆力、计算力、识别力,一般认为,大脑是由数量庞大,可能超过300亿个神经元,以各种各样的方式连接,通过信号的传递与处理,进而形成记忆力、计算力、识别力。我们一起来看一下人类的大脑的基础组成部分神经元:神经元的工作包括数据的传输(输入、输出),而神经元之间是由神经传导物质与突触的结合二、机器的神经元。从很久以前,脑神经科学就盛行于全世界,不过,要了解人类脑部的机制,我们还需要很长路要走。但是人工智能模仿人类的脑的运行机制,构建出来的类神经网络。同样的组成这个网络的神经元数量非常多。有人说这个数字也在300亿以上。机器神经元就像真正的神经元一样,有许多输入管道,以及一个输出管道。输入可以是1或者0。二、感知机感知机包括两层彼此相连的机器神经元。从前的机器神经元只能输入0或者1的信息,但是现在的感知机可以输入实数。而感知机的一大特征就是可以调节连接强
Giventwosortedintegerarrays nums1 and nums2,merge nums2 into nums1 asonesortedarray.Note: Youmayassumethat nums1 hasenoughspace(sizethatisgreaterorequalto m + n)toholdadditionalelementsfrom nums2.Thenumberofelementsinitializedin nums1 and nums2 are m and n respectively.归并两个有序数组,当然不能用现成的函数。从结尾开始扫描,先放大的数,这样可以避免覆盖前面的空间。classSolution{ public: voidmerge(vector<int>&nums1,intm,vector<int>&nums2,intn){ inte1=m-1,e2=n-1,e3=m+n-1; while(e1>=0||e2>=0) { if(e1==-1) nums1[e3--]=num
WordPress是一个内容管理系统,可让你托管和构建网站。WordPress包含插件架构和模板系统,因此你可以自定义任何网站以适合你的业务、博客、投资组合或在线商店。WordPress以其易于安装而闻名。安装WordPress是一个非常简单的过程,只需很少的时间即可完成。你可以使用几种不同的方法在你的网站上安装WordPress。在本文中,我们将看到可用于安装WordPress的两种最常用的方法。方法1:使用自动安装程序安装WordPress此方法是安装WordPress的最简单方法。你的托管服务提供商已经为你完成了所有工作。你只需要输入一些细节。某些托管服务提供商不提供此功能,那么你必须按照方法2中的说明手动安装WordPress。大多数cPanel都带有WordPress自动安装程序。当你登录到你的cPanel仪表板时,你可以看到会有一个自动安装程序。自动安装程序基本上自动化了整个WordPress安装过程。你只需输入一些基本信息,单击一个按钮,自动安装程序就会为你安装WordPress。要开始使用,请在cPanel中找到指向WordPress自动安装程序的链接并安装它。接下来,
主要分为以下几个要素的指标: DiskIO、CPU、mem、Net、MySQL Web性能测试工具: 客户端 服务器端: 服务器性能测试工具: 服务器性能瓶颈分析工具: ab,siege,curl, 参考: 1.郭欣《构建高性能web站点》 2. https://github.com/me115/linuxtools_rst 3. http://linuxtools-rst.readthedocs.org/zh_CN/latest/advance/03_optimization.html 4.mysqlIO性能调优方法与工具 5.Webapp性能测试方法 6. 作者: fandyst 出处: http://www.cnblogs.com/todototry/ 关注语言: python、javascript(node.js)、objective-C、java、R、C++ 兴趣点: 互联网、大数据
最近遇到的问题,java如何调用http请求json: publicclassHttpClientUtil{ privatestaticfinalStringCONTENT_TYPE_TEXT_JSON="text/json"; privatestaticfinalStringAPPLICATION_JSON="application/json"; publicstaticStringpostJson(Stringurl,Stringjson){ CloseableHttpClienthttpclient=HttpClients.createDefault(); HttpPosthttppost=newHttpPost(url); httppost.addHeader(HTTP.CONTENT_TYPE,APPLICATION_JSON); try{ StringEntityse=newStringEntity(json); se.setContentType(CONTENT_TYPE_TEXT_JSON); se.setContentEncoding(newBasicHeader
CF1336DYuiandMahjongSet(交互) 题面大意 这是一道交互题。 有一个由\(n\)个数构成的集合\(S\),内部元素可以重复。 保证,内部元素的值\(a_i\)都满足\(1\lea_i\len\),且对于一种值\(k\)保证\((\sum_{i\inS}[a_i=k])\len\),即每种值在集合内不会出现超过\(n\)次。 定义一个\(\mathbf{triplet}\)为\(S\)的一个大小为\(3\)的子集,且这三个元素的值相同。 定义一个\(\mathbf{straight}\)为\(S\)的一个大小为\(3\)的子集,且这三个元素的值连续,例如\(\{2,3,4\}\)是一个\(\mathbf{straight}\),但是\(\{1,3,5\}\)不是一个\(\mathbf{straight}\) 例如,对于集合\(\{1,2,2,1,3\}\)中,其\(\mathbf{straight}\)的数量为\(4\) 现在你可以进行至多\(n\)次查询操作和\(1\)次回答操作: 查询操作:将一个数\(x(1\lex\len)\)插入集合\(S\),然后交互
普通的分页,在数据量不太多的情况下还可以,若数据量达到大几十万、或百万以上级别,性能就明显慢了,且随着数据量的增加越来越慢,例如: 普通的分页: SELECTuser_name,user_idFROMorg_userwheredept_id=2 ORDERBYuser_idascLIMIT5000000,100复制 limit这种方式,会遍历前面无关的5000000行数据,再向后查询100条,所以当数据量越大就会越慢。 跳过前面5000000行无关的数据页遍历,可以直接通过索引定位到第5000001,第5000002行,这样操作更快了可以优化为快速定位要访问的数据行,如: SELECTa.user_name,a.user_idFROMorg_usera, (selectuser_idfromorg_userwheredept_id=2ORDERBYuser_idascLIMIT5000000,100)b wherea.user_id=b.user_id;复制 这样数据库查询引擎会通过索引跳过无关数据行,然后查询相关数据行了,查询条件必须要命中索引才行。
#_*_coding:utf-8_*_fromseleniumimportwebdriverdriver=webdriver.Firefox()driver.get("http://www.baidu.com")driver.find_element_by_id("kw").send_keys("Selenium2")driver.find_element_by_id("su").click()复制 解决办法,安装浏览器的驱动复制 安装三大浏览器驱动driver 1.chromedriver下载地址:https://code.google.com/p/chromedriver/downloads/list 2.Firefox的驱动geckodriver下载地址:https://github.com/mozilla/geckodriver/releases/ 3.IE的驱动IEdriver下载地址:http://www.nuget.org/pa
基于jQuery的图片加载loading效果插件 图片loading的效果是网页中比较常见的,尤其是对大图片,loading效果让用户能够明白图片加载的过程。 实现思路也是比较简单的: $.fn.LoadingImg=function(){ returnthis.each(function(){ varthat=this; varsrc=$(this).attr("src2");//获取当前的src2属性 varimg=newImage();//建立新图片 img.src=src; varloading=$("<imgalt=\"加载中...\"class=\"loadingImg\"title=\"图片加载中...\"src=\"loading.gif\"/>"); $(this).after(loading);//添加loading图片 $(this).hide();//隐藏当前图片 $(img).load(function(){//当前图片下载完毕后 loading.remove(); $(that).attr("src",src); $(that).show();
主内存(RAM,随机访问内存)当计算机关闭时其数据就丢失。 对于cin和cout支持的函数调用和操作,c++提供的文件流也同样支持。前者需要#include<iostream>,后者需要#include<fstream>。流(stream)在写数据时是目的地,读数据时就是源头。 打开badgirl.txt文件: ofstreamfout("badgirl.txt");//以独占方式打开该文件,默认文件在当前目录(运行程序的那个目录),也可给出完整路径(加上驱动器盘符也可以,这就是绝对路径,例如"c:\\badgirl.txt"就是c:\badgirl.txt文件的绝对路径)。还有ifstream、fstream fout<<"youbadbutsexygirl!"<<endl; fout<< "andyouneedbadboy!" fout.close(); fout对象提供了一条通向磁盘文件的道路。用面向对象的术语说,fout封装了那个文件并使之具备了接收输出数据的能力。另外,虽然程序成功退出是、时C++会自动关闭
原文地址:http://www.cnblogs.com/ChrisWang/archive/2009/11/28/1612815.html 关于Java的Daemon线程的理解 网上对Java的Daemon线程的说法很多,看的人头晕。 所以自己就来总结一下: Java语言自己可以创建两种进程“用户线程”和“守护线程” 用户线程:就是我们平时创建的普通线程. 守护线程:主要是用来服务用户线程. 那么如何来区分这两种线程呢? 其实在JDK的文档中已经说明的很清楚了: *TheJavaVirtualMachineexitswhentheonlythreadsrunningareall *daemonthreads.复制 即:复制 当线程只剩下守护线程的时候,JVM就会退出.但是如果还有其他的任意一个用户线程还在,JVM就不会退出.复制 复制 下面我们用实验来说明,当线程只剩下守护线程的时候,JVM就会退出.复制 代码如下:复制 publicclassDaemonRunnerimplementsRunnable{ publicvoidrun(){ while(true){ for
题目链接:https://www.root-me.org/en/Challenges/Web-Server/Install-files 题目提示: 1.你知道phpbb吗? 2.installfile 打开题目发现什么东西也没有,F12发现有注释 <!--/web-serveur/ch6/phpbb--> 复制 给了提示后面可以加phpbb http://challenge01.root-me.org/web-serveur/ch6/phpbb 复制 打开后依旧什么也没有,这该怎么走。先了解下phpbb,一个论坛软件,看看官网关于install的support https://www.phpbb.com/support/documents.php?mode=install&version=3 可以看到给出的其中一个例子 PointyourwebbrowsertothelocationwhereyouuploadedthephpBB3fileswiththeadditionof install/app.php o
3.1.mdn文档 https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/await 3.2.async函数 1.函数的返回值为promise对象 2.promise对象的结果由async函数执行的返回值决定 3.3.await表达式 1.await右侧的表达式一般为promise对象,但也可以是其它的值 2.如果表达式是promise对象,await返回的是promise成功的值 3.如果表达式是其它值,直接将此值作为await的返回值 3.4.注意 1.await必须写在async函数中,但async函数中可以没有await 2.如果await的promise失败了,就会抛出异常,需要通过try...catch捕获处理 <script>
StringBuffer *Athread-safe,mutablesequenceofcharacters. *Astringbufferislikea{@linkString},butcanbemodified.Atany *pointintimeitcontainssomeparticularsequenceofcharacters,but *thelengthandcontentofthesequencecanbechangedthroughcertain *methodcalls. 复制 StringBuffer是线程安全的,可变字符序列。 StringBuffer像String,但是可以被修改。 常用的方法: 1.length():返回字符串的数量。 publicintlength(){ returncount; } 复制 2.StringBuffer构造函数 初始化函数,StringBuffer的容量是初始的参数的长度+16. /** *Constructsastringbufferinitializedtothecontentsofth
221最大正方形 我的解法如下 classSolution{ publicintmaximalSquare(char[][]matrix){ int[][]dp=newint[matrix.length][matrix[0].length]; //x,y代表xy为右上角的最大正方形的边长 intmax=0; for(inti=0;i<matrix.length;i++){ for(intj=0;j<matrix[0].length;j++){ intc=matrix[i][j]-48; if(i==0||j==0||c==0||dp[i-1][j-1]==0){ dp[i][j]=c; }else{ intk=dp[i-1][j-1]; ints=1; for(;s<=k;s++){ if(matrix[i-s][j]!=49||matrix[i][j-s]!=49){ break; } } dp[i][j]=s; } max=Math.max(dp[i][j],max); } } returnmax*max;