• 安装Apachi


    1.打开Xshell把五个压缩包粘贴进/opt目录下

    2.打开/opt目录查看

     3.解压缩文件

    1. 1.tar zxvf apr-1.6.2.tar.gz
    2. 2.tar zxvf apr-util-1.6.0.tar.gz
    3. 3.tar jxvf httpd-2.4.29.tar.bz2

    4.查看

    5. 把其余两个压缩包剪切复制到httpd-2.4.29/srclib/apr目录下

    1. [root@localhost opt]# mv apr-1.6.2 httpd-2.4.29/srclib/apr
    2. [root@localhost opt]# mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util

    6.进入路径下查看

    7.安装环境

    [root@localhost srclib]# yum -y install gcc gcc-gcc++ make pcre-devel expat-devel perl

     8.在阿帕奇主程序下安装模块

    [root@localhost httpd-2.4.29]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi

    9.编译和安装

    [root@localhost httpd-2.4.29]# make && make install
    

    10.把/usr/local/httpd/bin/的apachectl拷贝到init.d/目录下并修改名字为httpd

    [root@localhost httpd-2.4.29]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
    

    11.编译添加命令

    1. 1.打开文件
    2. [root@localhost httpd-2.4.29]# vi /etc/init.d/httpd
    3. 2.在开头添加
    4. #!/bin/sh
    5. # chkconfig: 35 85 21 //35级自动运行 第85个启动 第21个关闭
    6. # description: Apache is a World Wide Wed server

    12.打开文件修改配置

    1. 1.打开文件
    2. [root@localhost httpd-2.4.29]# vi /usr/local/httpd/conf/httpd.conf
    3. 2.把#去掉
    4. # ServerName gives the name and port that the server uses to identify itself.
    5. # This can often be determined automatically, but we recommend you specify
    6. # it explicitly to prevent problems during startup.
    7. #
    8. # If your host doesn't have a registered DNS name, enter its IP address here.
    9. #
    10. ServerName www.example.com:80 //去掉#号
    11. #
    12. # Deny access to the entirety of your server's filesystem. You must
    13. # explicitly permit access to web content directories in other

    13.删除/usr/local/httpd/htdocs/目录下的文件

    1. [root@localhost httpd-2.4.29]# cd /usr/local/httpd/htdocs/
    2. [root@localhost htdocs]# ll
    3. 总用量 4
    4. -rw-r--r-- 1 root root 45 611 2007 index.html
    5. [root@localhost htdocs]# cat index.html
    6. <html><body><h1>It works!</h1></body></html>
    7. [root@localhost htdocs]# rm index.html
    8. rm:是否删除普通文件 "index.html"?y
    9. [root@localhost htdocs]#

    14,在/usr/local/httpd/htdocs下导入html类型的文件

    15. 做链接(文件名太长了)

    1. [root@localhost htdocs]# ln -s /usr/local/httpd/conf/httpd.conf /etc //链接
    2. [root@localhost htdocs]# vi /etc/httpd.conf //查看命令
    3. [root@localhost htdocs]# ln -s /usr/local/httpd/bin/* /usr/local/bin/ //链接
    4. [root@localhost htdocs]#

    16.关闭两个防火墙

    1. [root@localhost htdocs]# systemctl stop firewlald
    2. Failed to stop firewlald.service: Unit firewlald.service not loaded.
    3. [root@localhost htdocs]# setenforce 0
    4. setenforce: SELinux is disabled
    5. [root@localhost htdocs]#

    17.检查语法

    1. [root@localhost htdocs]# httpd -t //httpd
    2. Syntax OK
    3. [root@localhost htdocs]# apachectl -t //阿帕奇
    4. Syntax OK

    18.开启阿帕奇,查看效果

     

     

  • 相关阅读:
    【强化学习论文合集】ICML-2021 强化学习论文
    【三大锁】悲观锁——mysql悲观锁
    在 Windows 终端运行已有的 Python 程序
    通关GO语言02 数据类型:你必须掌握的数据类型有哪些?
    从0开始python学习-29.selenium 通过cookie信息进行登录
    Linux-本地日志服务管理(rsyslog基础)
    2022世界传感器大会即将开幕 汉威科技邀您共享科技盛宴!
    spring常见问题汇总
    【C++】设计模式之工厂模式
    Flink重分区算子解析 - StreamPartitioner
  • 原文地址:https://blog.csdn.net/m0_60093791/article/details/126704820