源码编译安装部署lamp

源码部署lamp

源码安装apache服务

1.先安装源码编译所需的软件包,编译工具
[root@ftx httpd-2.4.57]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make
===================================================================================================
 Package                      Arch              Version                      Repository       Size
===================================================================================================
Installing:
 libtool                      x86_64            2.4.2-22.el7_3               base            588 k
Installing for dependencies:
 autoconf                     noarch            2.69-11.el7                  base            701 k
 automake                     noarch            1.13.4-3.el7                 base            679 k
 m4                           x86_64            1.4.16-10.el7                base            256 k
 perl-Thread-Queue            noarch            3.02-2.el7                   base             17 k

Transaction Summary
===================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 2.2 M
Installed size: 6.6 M
Downloading packages:
(1/5): autoconf-2.69-11.el7.noarch.rpm                                      | 701 kB  00:00:01     
(2/5): automake-1.13.4-3.el7.noarch.rpm                                     | 679 kB  00:00:01     
(3/5): libtool-2.4.2-22.el7_3.x86_64.rpm                                    | 588 kB  00:00:00     
(4/5): perl-Thread-Queue-3.02-2.el7.noarch.rpm                              |  17 kB  00:00:00     
(5/5): m4-1.4.16-10.el7.x86_64.rpm                                          | 256 kB  00:00:00     
---------------------------------------------------------------------------------------------------
Total                                                              1.1 MB/s | 2.2 MB  00:00:01 
省略...
Installed:
  libtool.x86_64 0:2.4.2-22.el7_3                                                                  

Dependency Installed:
  autoconf.noarch 0:2.69-11.el7          automake.noarch 0:1.13.4-3.el7  m4.x86_64 0:1.4.16-10.el7 
  perl-Thread-Queue.noarch 0:3.02-2.el7 

Complete!
//安装开发工具包
[root@ftx ~]# yum groups mark install 'Development Tools'

//创建apache服务的用户和组
[root@ftx ~]# groupadd -r apache
[root@ftx ~]# useradd -r -M -s /sbin/nologin -g apache apache 
1.进入Apach官网,拉取httpd源码包以及相关依赖包

Apache官方网站

Index of /httpd (apache.org)

Index of /apr (apache.org)

//下载和解压httpd、apr以及apr-util
下载:
[root@ftx ~]# wget https://downloads.apache.org/httpd/httpd-2.4.57.tar.gz
省略...

[root@ftx ~]# wget https://downloads.apache.org/apr/apr-1.7.4.tar.gz
省略...

[root@ftx ~]# wget https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz
省略...

解压:
[root@ftx ~]# tar xf httpd-2.4.57.tar.gz 
[root@ftx ~]# tar xf apr-1.7.4.tar.gz 
[root@ftx ~]# tar xf apr-util-1.6.3.tar.gz 
[root@ftx ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.57.tar.gz
apr-1.7.4        apr-util-1.6.3    httpd-2.4.57
2.进入apr的源码包目录,在configure定制组件中修改相关信息

源码编译安装部署lamp_第1张图片

编译安装apr-1.7.4、apr-util-1.6.3、httpd-2.4.57
[root@ftx apr-1.7.4]# ./configure --prefix=/usr/local/apr
配置过程略...
[root@ftx apr-1.7.4]# make && make install
编译安装过程略...
[root@ftx apr-util-1.6.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
配置过程略...
[root@ftx apr-util-1.6.3]# make && make install
编译安装过程略...
[root@ftx httpd-2.4.57]# ./configure --prefix=/usr/local/apache \
--sysconfdir=/etc/httpd24 \
--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

[root@ftx httpd-2.4.57]# make && make install
编译安装过程略...
安装后配置
[root@ftx httpd-2.4.57]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/apache.sh
[root@ftx httpd-2.4.57]# source /etc/profile.d/apache.sh
[root@ftx httpd-2.4.57]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@ftx httpd-2.4.57]# echo 'MANPATH /usr/local/apache/man' >> /etc/man.config
//取消ServerName前面的注释
[root@ftx httpd-2.4.57]# sed -i '/#ServerName/s/#//g' /etc/httpd24/httpd.conf
启动httpd服务
[root@ftx httpd-2.4.57]# apachectl start

源码编译安装部署lamp_第2张图片

进入浏览器访问http网页

访问前关闭防火墙和selinux

[root@ftx httpd-2.4.57]# systemctl disable --now firewalld.service 
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@ftx httpd-2.4.57]# setenforce 0

源码编译安装部署lamp_第3张图片

源码编译报错信息处理

xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录

在安装 Apache 相关的依赖软件 apr-util 时可能会报这个错误,这是因为系统缺失 expat 库。

源码编译安装部署lamp_第4张图片

解决方法:
[root@ftx apr-util-1.6.3]# yum -y install expat-devel

安装mysql

1.安装依赖包
[root@ftx ~]# yum -y install ncurses-devel openssl-devel openssl make mariadb-devel libtool
===================================================================================================
 Package                  Arch              Version                          Repository       Size
===================================================================================================
Installing:
 cmake                    x86_64            2.8.12.2-2.el7                   base            7.1 M
 ncurses-devel            x86_64            5.9-14.20130511.el7_4            base            712 k
Installing for dependencies:
 libarchive               x86_64            3.1.2-14.el7_7                   base            319 k

Transaction Summary
===================================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 8.1 M
Installed size: 30 M
Installed:
  cmake.x86_64 0:2.8.12.2-2.el7            ncurses-devel.x86_64 0:5.9-14.20130511.el7_4           

Dependency Installed:
  libarchive.x86_64 0:3.1.2-14.el7_7                                                               

Complete!

2.创建用户和组
[root@ftx ~]# groupadd -r -g 306 mysql
[root@ftx ~]# useradd -r -M -s /sbin/nologin -g 306 -u 306 mysql
3.下载源码包并解压到/usr/local/
在官网上拉取5.7版本的mysql源码包到虚拟机中
[root@ftx src]# ls
debug  kernels  mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz
[root@ftx src]# tar xf mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@ftx src]# ls /usr/local/
apache  apr-util  etc    include  lib64    mysql-5.7.39-linux-glibc2.12-x86_64  share   apr       bin    games    lib      libexec     sbin       src
//创建链接
[root@ftx local]# ls
apache bin include libexec share
apr etc lib mysql-5.7.39-linux-glibc2.12-x86_64 src
apr-util games lib64 sbin
[root@ftx local]# ln -sv mysql-5.7.39-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.39-linux-glibc2.12-x86_64/'
[root@ftx local]# ll
total 0
drwxr-xr-x. 13 root root 152 Aug 28 15:50 apache
drwxr-xr-x. 6 root root 58 Aug 28 15:23 apr
drwxr-xr-x. 5 root root 43 Aug 28 15:28 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 Aug 28 09:46 lib64
drwxr-xr-x. 2 root root 6 Jun 22 2021 libexec
lrwxrwxrwx. 1 root root 36 Aug 28 16:31 mysql -> mysql-5.7.39-linux-glibc2.12-
x86_64/
drwxr-xr-x. 9 root root 129 Aug 28 16:28 mysql-5.7.39-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root 6 Jun 22 2021 sbin
drwxr-xr-x. 5 root root 49 Aug 28 09:46 share
drwxr-xr-x. 2 root root 6 Jun 22 2021 src

//修改目录/usr/local/mysql的属主属组
[root@ftx local]# chown -R mysql:mysql /usr/local/mysql
[root@ftx local]# ll /usr/local/mysql
lrwxrwxrwx. 1 mysql mysql 36 Aug 29 14:46 /usr/local/mysql -> mysql-5.7.39-linux-glibc2.12-x86_64/

//添加环境变量
[root@ftx local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@ftx local]# source /etc/profile.d/mysql.sh
[root@ftx local]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

//建立数据存放目录
[root@ftx local]# mkdir /opt/data
[root@ftx local]# chown -R mysql.mysql /opt/data/
[root@ftx local]# ll /opt/
total 0
drwxr-xr-x. 2 mysql mysql 6 Aug 29 14:47 data

[root@ftx local]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2023-08-29T06:49:27.229087Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-08-29T06:49:27.395416Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-08-29T06:49:27.421368Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-08-29T06:49:27.481717Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3285f64a-4638-11ee-9e19-000c294b3c0a.
2023-08-29T06:49:27.482520Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-08-29T06:49:27.721791Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-08-29T06:49:27.721803Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-08-29T06:49:27.722302Z 0 [Warning] CA certificate ca.pem is self signed.
2023-08-29T06:49:27.763092Z 1 [Note] A temporary password is generated for root@localhost: Kn6o    //临时密码“Kn6o”
4.配置mysql
[root@ftx ~]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
‘/usr/local/include/mysql’ -> ‘/usr/local/mysql/include/’
[root@ftx ~]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@ftx ~]# ldconfig
5.生成配置文件
[root@ftx ~]# cat > /etc/my.cnf < [mysqld]
> basedir = /usr/local/mysql
> datadir = /opt/data
> socket = /tmp/mysql.sock
> port = 3306
> pid-file = /opt/data/mysql.pid
> user = mysql
> skip-name-resolve
> EOF
6.配置服务启动脚本
[root@ftx ~]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@ftx ~]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@ftx ~]# sed -ri 's#^(datadir=).*#\1/opt/data#g' /etc/init.d/mysqld

//启动mysql
[root@ftx ~]# service mysqld start
Starting MySQL.Logging to '/opt/data/ftx.err'.
 SUCCESS!
 
 [root@ftx ~]# ps -ef|grep mysql
root     108759      1  0 14:53 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data --pid-file=/opt/data/mysql.pid
mysql    108937 108759  2 14:53 pts/1    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/localmysql --datadir=/opt/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=ftx.err --pid-file=/opt/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
root     108967 104740  0 14:53 pts/1    00:00:00 grep --color=auto mysql

//查看端口
[root@ftx ~]# ss -antl
State       Recv-Q Send-Q    Local Address:Port                   Peer Address:Port              
LISTEN      0      128                   *:22                                *:*                  
LISTEN      0      80                 [::]:3306                           [::]:*                  
LISTEN      0      128                [::]:80                             [::]:*                  
LISTEN      0      128                [::]:22                             [::]:* 
7.链接库文件
[root@ftx ~]# ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
[root@ftx ~]# ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
8.修改mysql密码,先用临时密码登录(临时密码只能使用一次)
[root@ftx ~]# mysql -uroot -p'Kn6o'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.39

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> set password = password('12345678');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit
Bye

安装PHP

1.安装依赖包
首先添加一个yum仓库
[root@ftx yum.repos.d]# vim server.repo
[Everything]
name=everything
baseurl=https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/
enabled=1
gpgcheck=0
[good]
name=good
baseurl=http://rpms.remirepo.net/enterprise/8/remi/x86_64/
enabled=1
gpgcheck=0
//安装依赖
[root@ftx ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libtool 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 php72-php-mysqlnd sqlite-devel
安装过程略...

[root@ftx ~]# wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
--2023-08-29 15:36:42--  https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz
Resolving github.com (github.com)... 192.30.255.113
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/kkos/oniguruma/tar.gz/refs/tags/v6.9.4 [following]
--2023-08-29 15:36:47--  https://codeload.github.com/kkos/oniguruma/tar.gz/refs/tags/v6.9.4
Resolving codeload.github.com (codeload.github.com)... 192.30.255.120
Connecting to codeload.github.com (codeload.github.com)|192.30.255.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘oniguruma-6.9.4.tar.gz’

    [             <=>                                          ] 582,597     15.5KB/s   in 40s    

2023-08-29 15:37:30 (14.1 KB/s) - ‘oniguruma-6.9.4.tar.gz’ saved [582597]

[root@ftx ~]# 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  oniguruma-6.9.4.tar.gz
apr-1.7.4.tar.gz  httpd-2.4.57           remi-release-7.rpm
[root@ftx ~]# tar xf oniguruma-6.9.4.tar.gz 
[root@ftx ~]# ls
anaconda-ks.cfg
apr-1.7.4
apr-1.7.4.tar.gz
apr-util-1.6.3
apr-util-1.6.3.tar.gz
httpd-2.4.57
httpd-2.4.57.tar.gz
mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz
oniguruma-6.9.4
oniguruma-6.9.4.tar.gz
[root@ftx ~]# cd oniguruma-6.9.4/
[root@ftx oniguruma-6.9.4]# ./autogen.sh
省略...
[root@ftx oniguruma-6.9.4]# ./configure --prefix=/usr --libdir=/lib64
省略...
[root@ftx oniguruma-6.9.4]# make && make install
省略...

2.下载php的二进制包,解压
[root@ftx ~]# wget --no-check-certificate https://www.php.net/distributions/php-8.2.9.tar.gz
[root@ftx ~]# ls
anaconda-ks.cfg   apr-util-1.6.3         httpd-2.4.57.tar.gz     php-8.2.9.tar.gz
apr-1.7.4         apr-util-1.6.3.tar.gz  oniguruma-6.9.4         remi-release-7.rpm
apr-1.7.4.tar.gz  httpd-2.4.57           oniguruma-6.9.4.tar.gz
[root@ftx ~]# tar xf php-8.2.9.tar.gz 
[root@ftx ~]# ls
anaconda-ks.cfg   apr-util-1.6.3         httpd-2.4.57.tar.gz     php-8.2.9
apr-1.7.4         apr-util-1.6.3.tar.gz  oniguruma-6.9.4         php-8.2.9.tar.gz
apr-1.7.4.tar.gz  httpd-2.4.57           oniguruma-6.9.4.tar.gz  remi-release-7.rpm
[root@ftx ~]# cd php-8.2.9/
3.编译安装php
[root@ftx php-8.2.9]#./configure --prefix=${install_dir}/$php  \
           --with-config-file-path=/etc \
           --enable-fpm \
           --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-zlib-dir \
           --enable-gd \
           --with-gettext \
           --with-jpeg \
           --with-freetype \
           --enable-mbstring \
           --enable-pdo \
           --with-mysqli=mysqlnd \
           --with-pdo-mysql=mysqlnd \
           --with-readline \
           --enable-shmop \
           --enable-simplexml \
           --enable-sockets \
           --enable-mysqlnd-compression-support \
           --with-pear \
           --enable-pcntl \
           --enable-posix

//编译和安装
[root@ftx php-8.2.9]# make && install make

//配置环境变量
[root@ftx php-8.2.9]# echo 'export PATH=/usr/local/php8/bin:$PATH' > /etc/profile.d/php8.sh
[root@ftx php-8.2.9]# source /etc/profile.d/php8.sh

[root@ftx php-8.2.9]# which php
/usr/local/php8/bin/php
[root@ftx php-8.2.9]# php -v
PHP 8.2.9 (cli) (built: Aug 29 2023 15:58:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.9, Copyright (c) Zend Technologies
4.配置php-fpm
[root@ftx php-8.2.9]# cp php.ini-production /etc/php.ini
[root@ftx php-8.2.9]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@ftx php-8.2.9]# chmod +x /etc/rc.d/init.d/php-fpm
[root@ftx php-8.2.9]# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[root@ftx php-8.2.9]# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
5.编辑php-fpm的配置文件
[root@ftx php-8.2.9]# vim /usr/local/php8/etc/php-fpm.conf
[root@ftx php-8.2.9]# tail -4 /usr/local/php8/etc/php-fpm.conf
pm.max_children = 50              //最多同时提供50个进程提供50个并发服务
pm.start_servers = 5                //启动时启动5个进程
pm.min_spare_servers = 2      //最小空闲进程数
pm.max_spare_servers = 8     //最大空闲进程数
6.启动php-fpm
//启动php-fpm
[root@ftx php-8.2.9]# service php-fpm start
Starting php-fpm  done

//默认情况下,fpm监听在127.0.0.1的9000端口,也可以使用如下命令验证其是否已经监听在相应的套接字
[root@ftx php-8.2.9]# ss -anlt
State       Recv-Q Send-Q    Local Address:Port                   Peer Address:Port              
LISTEN      0      128           127.0.0.1:9000                              *:*                  
LISTEN      0      128                   *:22                                *:*                  
LISTEN      0      80                 [::]:3306                           [::]:*                  
LISTEN      0      128                [::]:80                             [::]:*                  
LISTEN      0      128                [::]:22                             [::]:*

[root@ftx php-8.2.9]# ps -ef | grep php
root     109503      1  0 16:17 ?        00:00:00 php-fpm: master process (/usr/local/php8/etc/php-fpm.conf)
nobody   109504 109503  0 16:17 ?        00:00:00 php-fpm: pool www
nobody   109505 109503  0 16:17 ?        00:00:00 php-fpm: pool www
nobody   109506 109503  0 16:17 ?        00:00:00 php-fpm: pool www
nobody   109507 109503  0 16:17 ?        00:00:00 php-fpm: pool www
nobody   109508 109503  0 16:17 ?        00:00:00 php-fpm: pool www
root     109511  87596  0 16:18 pts/1    00:00:00 grep --color=auto php
8. 配置apache

启用httpd的代理模块

[root@ftx php-8.2.9]# sed -i '/proxy_module/s/#//g' /etc/httpd24/httpd.conf
[root@ftx php-8.2.9]# sed -i '/proxy_fcgi_module/s/#//g' /etc/httpd24/httpd.conf

创建虚拟主机目录,写一个测试网页

[root@ftx php-8.2.9]# mkdir /usr/local/apache/htdocs/www.ftx.com
[root@ftx php-8.2.9]# vim /usr/local/apache/htdocs/www.ftx.com/index.php
[root@ftx php-8.2.9]# cat /usr/local/apache/htdocs/www.ftx.com/index.php


[root@ftx php-8.2.9]# chown -R apache.apache /usr/local/apache/htdocs/
[root@ftx php-8.2.9]# ll -d /usr/local/apache/htdocs/
drwxr-xr-x. 3 apache apache 43 Aug 29 16:34 /usr/local/apache/htdocs/

创建虚拟主机

//在配置文件的最后加入以下内容
[root@ftx php-8.2.9]# tail -13 /etc/httpd24/httpd.conf

DocumentRoot "/usr/local/apache/htdocs/www.ftx.com"
ServerName www.ftx.com
ProxyRequests Off          //关闭正向代理
ProxyPassMatch ^/(.*\.php)$
fcgi://127.0.0.1:9000/usr/local/apache/htdocs/www.ftx.com/$1

Options none
AllowOverride none
Require all granted



//搜索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    //此行
    
//添加index.php优先

    DirectoryIndex index.php index.html   //添加一个index.php

重启httpd服务

[root@ftx php-8.2.9]# apachectl restart
[root@ftx php-8.2.9]# ss -antl
State       Recv-Q Send-Q    Local Address:Port                   Peer Address:Port              
LISTEN      0      128           127.0.0.1:9000                              *:*                  
LISTEN      0      128                   *:22                                *:*                  
LISTEN      0      80                 [::]:3306                           [::]:*                  
LISTEN      0      128                [::]:80                             [::]:*                  
LISTEN      0      128                [::]:22                             [::]:*

关闭防火墙和selinux

[root@ftx php-8.2.9]# systemctl disable --now firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@ftx php-8.2.9]# setenforce 0

在真机的C:\Windows\System32\drivers\etc\hosts里写入ip和域名的绑定

源码编译安装部署lamp_第5张图片

9.在浏览器访问域名测试

访问index.php网页
源码编译安装部署lamp_第6张图片

访问index.html网页

源码编译安装部署lamp_第7张图片

你可能感兴趣的:(运维,mysql)