• CentOS Apache服务器安装与配置


    CentOS Apache httpd ConfigNote


    一、安装Apache程序,一般有三种安装方式:
    1.直接网络安装;
    yum install -y httpd
    2.下载rpm包,上传至服务器进行安装;
    rpm -qa | grep httpd
    ------------------------------
    启动/停止/重新启动/状态
    service httpd start
    service httpd stop
    service httpd restart
    service httpd status
    pstree | grep httpd //验证服务是否启动,比较少用;
    启动时,如果提示如下信息:
    正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
    编辑/etc/httpd/conf/httpd.conf
    找到如下内容:
    #ServerName www.example.com:80
    更改为
    ServerName localhost:80
    再重启一下Apache服务即可;
    ------------------------------
    测试安装配置是否成功
    http://ip地址
    如果出来:Apache 2 Test Page powered by CentOS 说明就OK了,简单吧;
    如果打不开,那应该是iptables的问题;
    编辑/etc/sysconfig/iptables
    添加如下内容:
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
    然后重启一下iptables服务可;
    ------------------------------
    二基本配置:
    1.针对主机环境的设置项目
    编辑/etc/httpd/conf/httpd.conf
    KeepAlive off
    更改为
    KeepAlive on
    MaxKeepAliveRequests 100
    更改为
    MaxKeepAliveRequests 500 //为了增进效率则可以改大一点;

    StartServers 8
    MinSpareServers 5
    MaxSpareServers 20
    ServerLimit 256
    MaxClients 256
    MaxRequestsPerChild 4000

    StartServers 4
    MaxClients 300
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 25
    MaxRequestsPerChild 0
    两个执行模块,默认使用prefork模块,如果想使用worker模块编辑如下文件:
    /etc/sysconfig/httpd
    找下如下内容:
    #HTTPD=/usr/sbin/httpd.worker
    更改为
    HTTPD=/usr/sbin/httpd.worker
    然后重启一下apache服务即可;
    ------------------------------
    2.针对中文Big5编码语言
    编辑/etc/httpd/conf/httpd.conf
    找到如下内容:
    AddDefaultCharset UTF-8
    更改为
    #AddDefaultCharset UTF-8
    或者
    AddDefaultCharset gb2313 //根据实际情况设置;
    找到如下内容:
    LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
    更改为
    LanguagePriority zh-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-TW
    然后重启一下apache服务即可;
    ------------------------------
    3.针对首页权限相关设置
    编辑/etc/httpd/conf/httpd.conf
    找到如下内容:
    Options Indexes FollowSymLinks
    更改为
    Options FollowSymLinks MultiViews
    然后重启一下apache服务即可;
    ------------------------------
    4.设置开机自动启动
    chkconfig httpd on
    ------------------------------

    古有内事不决问张昭,外事不决问周瑜; 今有生活不懂问百度,学术不懂问谷歌。 (SunQuan)The inner undecided ask ZhangZhao, the outer undecided ask ZhouYu. (I)Life unknown ask Baidu, academic unknown ask Google.
  • 相关阅读:
    android stagefright awesomeplayer 分析
    stagefright框架(七)-Audio和Video的同步
    stagefright框架(六)-Audio Playback的流程
    Windows Sockets Error Codes
    编译boost (windows msvc14)
    golang windows程序获取管理员权限(UAC ) via gocn
    阿里云容器服务--配置自定义路由服务应对DDOS攻击
    store / cache 系列
    一些项目感悟
    protobuf-3.0.0-beta-2 windows编译 x64/x86
  • 原文地址:https://www.cnblogs.com/luoyanghero/p/5699103.html
Copyright © 2020-2023  润新知