zoukankan      html  css  js  c++  java
  • DevOps之二:搭建SVN服务器--Apache HTTP Server安装

    安装环境
      Red Hat Enterprise Linux Server release 7.3 (Maipo)
      jdk1.7.0_80

      httpd-2.4.35.tar.gz

      apr-1.6.5.tar.gz、apr-util-1.6.1.tar.gz、apr-iconv-1.2.2.tar.gz

      pcre-8.42.tar.gz
      安装依赖gcc,gcc-c++,uuid-devel,libuuid-devel

    Apache HTTP Server是Web服务器,支持http、SSL协议,Subversion默认使用svn://ip:3690访问,整合Apache HTTP Server之后就可以使用浏览器http(s)方式访问。

    一、安装Apache HTTP Server
    在线安装:yum install httpd -y
    离线安装:
    (1)Apache HTTP Server下载
    httpd-2.4.35.tar.gz,下载地址:http://httpd.apache.org/download.cgi
    (2)依赖包下载 apr、apr-util、apr-iconv和pcre
    apr-1.6.5.tar.gz、apr-util-1.6.1.tar.gz、apr-iconv-1.2.2.tar.gz,下载地址:http://apr.apache.org/download.cgi
    pcre-8.42.tar.gz下载地址:https://sourceforge.net/projects/pcre/files/pcre/
    (3)解压 安装apr
    #解压
    tar -zxvf apr-1.6.5.tar.gz -C /home/cluster/apr
    #配置 注意 --prefix指定安装路径,apr-1.6.5是源文件目录,可以指定其他目录为安装目录
    cd /home/cluster/apr/apr-1.6.5
    ./configure --prefix=/home/cluster/apr/apr-1.6.5
    #编译安装
    make && make install

    (4)解压 安装apr-iconv
    #解压
    tar -zxvf apr-iconv-1.2.2.tar.gz -C /home/cluster/apr
    #配置
    cd /home/cluster/apr/apr-iconv-1.2.2
    ./configure --prefix=/home/cluster/apr/apr-iconv-1.2.2 --with-apr=/home/cluster/apr/apr-1.6.5
    #编译安装
    make && make install

    (5)解压 安装apr-util
    #解压
    tar -zxvf apr-util-1.6.1.tar.gz -C /home/cluster/apr
    #配置
    cd /home/cluster/apr/apr-util-1.6.1
    ./configure --prefix=/home/cluster/apr/apr-util-1.6.1 --with-apr=/home/cluster/apr/apr-1.6.5 --with-apr-iconv=/home/cluster/apr/apr-iconv-1.2.2/bin/apriconv
    #编译安装
    make && make install

    编译apr-util-1.6.1 报错
    xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
    原因:缺少expat库
    解决方法:
    在线安装:yum install expat-deve -y
    或者寻找系统镜像ISO中找ls -l|grep expat-devel
    expat-devel-2.1.0-8.el7.x86_64.rpm
    root用户安装:rpm -ivh expat-devel-2.1.0-8.el7.x86_64.rpm

    (6)解压 安装pcre
    #解压
    tar -zxvf pcre-8.42.tar.gz -C /home/cluster
    #配置
    cd /home/cluster/pcre-8.42
    ./configure --prefix=/home/cluster/pcre-8.42
    #编译安装
    make && make install

    配置报错 :Invalid c++ compiler
    原因:需要安装gcc-c++

    (7)解压 安装apache
    #解压
    tar -zxvf httpd-2.4.35.tar.gz -C /home/cluster
    #创建安装目录
    mkdir -p /home/cluster/apache
    #配置
    cd /home/cluster/httpd-2.4.35
    ./configure --prefix=/home/cluster/apache --with-apr=/home/cluster/apr/apr-1.6.5 --with-apr-util=/home/cluster/apr/apr-util-1.6.1 --with-pcre=/home/cluster/pcre-8.42
    #编译 安装
    make && make install
    (8)修改配置httpd.conf
    [cluster@PCS102 conf]$ vim /home/cluster/apache/conf/httpd.conf
    添加一行配置:ServerName localhost:80

    (9)apache 启停
    (9.1)版本验证:
    [cluster@PCS102 bin] /home/cluster/apache/bin/apachectl -v
    Server version: Apache/2.4.35 (Unix)
    Server built: Oct 12 2018 15:04:40
    (9.2)
    #启动
    /home/cluster/apache/bin/apachectl start
    #停止
    /home/cluster/apache/bin/apachectl stop
    #重启
    /home/cluster/apache/bin/apachectl restart
    #要在重启 Apache 服务器时不中断当前的连接,则应运行
    /home/cluster/apache/bin/apachectl graceful

    (9.3)将apache作为服务启停
    第一步
    [root@PCS102 init.d]# cp /home/cluster/apache/bin/apachectl /etc/init.d/httpd

    第二步
    vi /etc/init.d/httpd
    第二行开始加入:
    # Startup script for the Apache Web Server
    # chkconfig: 35 61 61
    # description: Apache is a World Wide Web server.
    备注;第一行的3个参数意义分别为:在哪些运行级别启动httpd(3,5);启动序号(S61);关闭序号(K61)。
    注意:第二行的描述必须要写!
    第三步
    chmod 755 /etc/init.d/httpd
    chkconfig --add httpd
    chkconfig httpd on

    然后就可以使用服务启停apache
    service httpd start 启动
    service httpd restart 重新启动
    service httpd stop 停止服务

    (10)启动验证
    (10.1)ps -ef |grep httpd #查看apache进程
    daemon 25554 27645 0 16:47 ? 00:00:00 /home/cluster/apache/bin/httpd -k start
    daemon 25555 27645 0 16:47 ? 00:00:00 /home/cluster/apache/bin/httpd -k start
    daemon 25556 27645 0 16:47 ? 00:00:00 /home/cluster/apache/bin/httpd -k start
    root 27645 1 0 15:27 ? 00:00:00 /home/cluster/apache/bin/httpd -k start
    (10.2)netstat -tulnp |grep 80 #查看apache是否监听80端口
    tcp6 0 0 :::80 :::* LISTEN 25554/httpd
    (10.3)curl localhost #访问apache
    <html><body><h1>It works!</h1></body></html>

    (10.4)浏览器输入  http://134.32.123.102  回车



    启动报错:
    1、AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 134.32.123.102. Set the 'ServerName' directive globally to suppress this message
    (13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
    (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    AH00015: Unable to open logs
    默认1024以下端口只有root用户可以使用,http默认端口80,可以使用root用户来启动 或者换一个端口

    2、AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 134.32.123.102. Set the 'ServerName' directive globally to suppress this message
    无法可靠地确定服务器的完全限定域名
    修改httpd.conf 修改配置:ServerName localhost:80

    3、访问403 Forbidden You don't have permission to access / on this server.
    访问路径权限问题:比如网站主目录:DocumentRoot "/home/cluster/apache/htdocs"
    那么每一层文件夹都是可读的 配置权限chmod 755

    参考:
    https://blog.csdn.net/u011277123/article/details/77847360
    http://blog.sina.com.cn/s/blog_505bf9af01012lpm.html
    https://www.linuxidc.com/Linux/2017-04/142589.htm
    https://www.linuxidc.com/Linux/2015-08/121073.htm

  • 相关阅读:
    算法笔记--中国剩余定理
    算法笔记--辛普森积分公式
    算法笔记--数学之不定方程解的个数
    算法笔记--卢卡斯定理
    洛谷 P3808 【模板】AC自动机(简单版)洛谷 P3796 【模板】AC自动机(加强版)
    hihocoder #1419 : 后缀数组四·重复旋律4
    codevs 3044 矩形面积求并 || hdu 1542
    Stamps ans Envelope Sive UVA
    洛谷 P2061 [USACO07OPEN]城市的地平线City Horizon
    bzoj 3277: 串
  • 原文地址:https://www.cnblogs.com/cac2020/p/9783048.html
Copyright © 2011-2022 走看看