lamp架构
lamp平台安装顺序:
httpd>mysql>php
1.[root@localhost ~]# dnf -y install httpd* 2.[root@localhost ~]# dnf -y install mariadb* 3.[root@clq ~]# dnf -y install php* [root@clq ~]# wget -c #继续下载 #包下载地址:https://wordpress.org/download/releases/ #5.7版本 https://wordpress.org/wordpress-5.7.tar.gz #5.6版本 https://wordpress.org/wordpress-5.6.2.tar.gz #php5.6以上ok #mysql5.0以上ok 4.解压:[root@clq ~]# tar xf wordpress-5.6.2.tar.gz [root@clq ~]# ll drwxr-xr-x. 5 nobody nobody 4096 Feb 22 23:10 wordpress 5.apache配置: [root@clq ~]# dnf list all|grep mod_proxy mod_proxy_html.x86_64 #此包提供模块 #模块文件 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so 看看目录下是否有模块文件 [root@clq ~]# cd /etc/httpd/conf.modules.d/ [root@clq conf.modules.d]# ls 00-base.conf 00-mpm.conf 00-systemd.conf 10-proxy_h2.conf 00-dav.conf 00-optional.conf 01-cgi.conf 15-php.conf 00-lua.conf 00-proxy.conf 10-h2.conf README [root@clq conf.modules.d]# cat 00-proxy.conf # This file configures all the proxy modules: 【LoadModule proxy_module modules/mod_proxy.so】 LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so 【LoadModule proxy_ajp_module modules/mod_proxy_ajp.so】 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_express_module modules/mod_proxy_express.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so LoadModule proxy_ftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so LoadModule proxy_scgi_module modules/mod_proxy_scgi.so LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so 6.httpd配置: #查找vhosts.conf路径 [root@clq ~]# find / -name *vhosts.conf /usr/share/doc/httpd/httpd-vhosts.conf #文件复制到conf.d下 [root@clq conf.d]# cp /usr/share/doc/httpd/httpd-vhosts.conf . #编辑httpd-vhosts.conf内容 <VirtualHost *:80> DocumentRoot "/var/www/html" ServerName www.example.com ProxyRequests Off ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1 <Directory "/var/www/html"> Options none AllowOverride none Require all granted </Directory> </VirtualHost> #改主配置文件: [root@localhost ~]# vim /etc/httpd/conf/httpd.conf #添加这俩行 AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps #添加index.php <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> 开启httpd mariadb php 服务(按照lamp顺序开启): 6.2[root@localhost conf.d]# systemctl start httpd [root@localhost conf.d]# systemctl stop firewalld [root@localhost conf.d]# setenforce 0 6.4[root@localhost html]# systemctl restart httpd 6.5[root@localhost ~]# systemctl start mariadb 7.[root@clq ~]# systemctl start mariadb php服务见下面的php配置!!! 7.1PHP配置: /etc/php.ini(php页面) /etc/php-fpm.d/www.conf(要配置的文件) [root@clq ~]# vim /etc/php-fpm.d/www.conf #搜索listen添加最下这一行 ; Note: This value is mandatory. ;listen = /run/php-fpm/www.sock listen = 127.0.0.1:9000 #开启服务 [root@clq ~]# systemctl start php-fpm.service #自启动服务 [root@clq ~]# systemctl enable php-fpm.service [root@clq ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 5 127.0.0.1:631 0.0.0.0:* LISTEN 0 128 127.0.0.1:9000 0.0.0.0:* LISTEN 0 80 0.0.0.0:3306 0.0.0.0:* LISTEN 0 128 0.0.0.0:111 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 5 [::1]:631 [::]:* LISTEN 0 128 [::]:111 [::]:* LISTEN 0 128 *:80 *:* #端口号9000开启 7.2#在/var/www/html下写如下内容: [root@clq html]# cat index.php <?php phpinfo(); ?>
7.3架构搭建成功!
7.4
#该目录文件覆盖到于此
[root@clq html]# mv ~/wordpress/* .
7.5
7.6创建mysql账号密码
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 352
Server version: 10.3.27-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)]>
7.7[root@localhost html]# vi wp-config.php
7.8
完成!!!