zoukankan      html  css  js  c++  java
  • Linux_Apache 安装

    1、下载依赖扩展 apr、apr-util、pcre(正则依赖)

    https://apr.apache.org/download.cgi#aprutil1

    apr:http://mirrors.shu.edu.cn/apache//apr/apr-1.6.3.tar.gz

    apr-util: http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz 

    http://www.pcre.org/

    pcre:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz

    apache  http://httpd.apache.org/

    apache:http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.33.tar.gz

    2、解压

    .tar    tar -xvf 文件名

    .tar.gz    tar -zxvf  文件名

    .tar.bz2     tar -jxvf  文件名

    3.修改文件名

    [zwesy@localhost ~]$ mv apr-1.6.3 apr
    [zwesy@localhost ~]$ mv apr-util-1.6.1 apr-util

    4.把解压后的apr apr-util 放到apche 下的srclib目录中

    [zwesy@localhost ~]$ mv apr apr-util  httpd-2.4.33/srclib/

    5.编译安装pcre

    进程在执行过程中可按ctrl+c中断

    [zwesy@localhost ~]$ cd pcre-8.42/
    [zwesy@localhost pcre-8.42]$ ./configure --prefix=/usr/local/pcre-8.42
    [zwesy@localhost pcre-8.42]$ make
    [zwesy@localhost pcre-8.42]$ sudo make install

    6.准备安装apache

    [zwesy@localhost httpd-2.4.33]$ ./configure --prefix=/usr/local/apache24 --with-pcre=/usr/local/pcre-8.42/bin/pcre-config -with-included-apr
    [zwesy@localhost httpd-2.4.33]$ make
    [zwesy@localhost httpd-2.4.33]$  sudo make install

    7.开启访问

    [zwesy@localhost ~]$ cd /usr/local/apache24/bin/
    [zwesy@localhost bin]$ sudo apachectl -k start   开启服务
    [zwesy@localhost bin]$ sudo apachectl -k stop   关闭服务
    [zwesy@localhost bin]$ sudo apachectl -k restart   重启服务

    Passing arguments to httpd using apachectl is no longer supported.
    You can only start/stop/restart httpd using this script.
    If you want to pass extra arguments to httpd, edit the
    /etc/sysconfig/httpd config file.

    开启防火墙80端口
    [zwesy@localhost bin]$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
    [zwesy@localhost bin]$ sudo systemctl restart firewalld.service

    8.进程查看

    [zwesy@localhost bin]$ ps aux | grep httpd
    httpd 是apache的进程名称
    root     17978  2.0  1.0 531296 64024 ?        Ssl  02:40   0:00 /usr/sbin/httpd -k restart
    apache   17982  0.0  0.2 400612 12880 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17987  1.6  0.3 541256 21184 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17988  1.6  0.3 541256 21908 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17989  1.7  0.3 541256 21184 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17990  1.5  0.3 541256 21184 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17991  1.6  0.3 541256 21184 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    apache   17995  2.5  0.3 541256 21200 ?        S    02:40   0:00 /usr/sbin/httpd -k restart
    zwesy    18002  0.0  0.0 112720   972 pts/0    S+   02:41   0:00 grep --color=auto httpd

    杀死子进程
    [zwesy@localhost bin]$ sudo kill -9 17978 17982 19887 17988 17989 17990 17991 17995

    [zwesy@localhost bin]$ ps aux | grep httpd
    zwesy    18552  0.0  0.0 112720   972 pts/0    S+   02:49   0:00 grep --color=auto httpd


  • 相关阅读:
    关于加密程序
    C++11的新特性lambda的小试牛刀RAII
    自动生成makefile的脚本
    关于pcre正则表达式库libpcre
    利用PHP执行SQL文件,将SQL文件导入到数据库
    Linux 系统是否适合于您?
    一个少年电脑病毒作者的独白
    PHP编程效率的20个要点
    JVM源码分析之javaagent原理完全解读
    如何更好的利用Node.js的性能极限
  • 原文地址:https://www.cnblogs.com/zwesy/p/9114581.html
Copyright © 2011-2022 走看看