#apache httpd
静态服务器
虚拟主机
正向代理服务器
反向代理服务器
httpd rewrite
http header
http X-Forwarded-For

https://www.cnblogs.com/langren1992/p/5160912.html 
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html 
https://blog.csdn.net/zhuoyr/article/details/8393854 


#配置重要内容摘抄
### Section 1: Global Environment
ServerRoot "/etc/httpd"
#Listen 12.34.56.78:80
Listen 80

### Section 2: 'Main' server configuration
DocumentRoot "/var/www/html"
DirectoryIndex index.html index.html.var
#<Proxy *>
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Proxy>

### Section 3: Virtual Hosts
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


#DocumentRoot "/var/www/html"
ServerRoot:服务器的基础目录 ServerRoot "/etc/httpd"
Listen:指定服务器监听的IP和端口
LoadModule:加载特定的DSO模块
User:设置实际提供服务的子进程的用户
Group:设置提供服务的Apache子进程运行时的用户组
ServerAdmin:设置在所有返回给客户端的错误信息中包含的管理员邮件地址
ServerName:设置服务器用于辨识自己的主机名和端口号
DocumentRoot:设置Web文档根目录
<Directory>和</Directory>用于封装一组指令,使之仅对某个目录及其子目录生效
DirectoryIndex:当客户端请求一个目录时寻找的资源列表
LogLevel:用于调整记录在错误日志中的信息的详细程度

include:在服务器配置文件中包含其它配置文件。
#指定虚拟主机配置文件并将其附加到主配置文件
Include conf/extra/httpd-vhosts.conf
#指定SSL配置文件并将其附加到主配置文件
Include conf/extra/httpd-ssl.conf

##SSL默认配置
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


https://www.cnblogs.com/langren1992/p/5160912.html
配置多路处理模块(MPM) httpd-mpm.conf
prefork模式
worker模式

prefork模式
这个多路处理模块(MPM)实现了一个非线程型的、预派生的web服务器,它的工作方式类似于Apache 1.3。它适合于没有线程安全库,需要避免线程兼容性问题的系统。它是要求将
每个请求相互独立的情况下最好的MPM,这样若一个请求出现问题就不会影响到其他请求。这个MPM具有很强的自我调节能力,只需要很少的配置指令调整。最重要的是将MaxClients设置为一个足够大的数值以处理潜在的请求高峰,同时又不能太大,以致需要使用的内存
超出物理内存的大小

worker模式
此多路处理模块(MPM)使网络服务器支持混合的多线程多进程。由于使用线程来处理请求,所以可以处理海量请求,而系统资源的开销小于基于进程的MPM。但是,它也使用了多进
程,每个进程又有多个线程,以获得基于进程的MPM的稳定性。控制这个MPM的最重要的指令是,控制每个子进程允许建立的线程数的ThreadsPerChild指令,和控制允许建立的总线程数的MaxClients指令

#设置prefork多路处理模块
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit    8000
    MaxClients         8000
    MaxRequestsPerChild   0
</IfModule>

#设置worker多路处理模块
<IfModule mpm_worker_module>
    StartServers          5
    ServerLimit          20
    ThreadLimit         200
    MaxClients         4000
    MinSpareThreads      25
    MaxSpareThreads   250
    ThreadsPerChild     200
    MaxRequestsPerChild   0
</IfModule>

https://blog.csdn.net/u012581409/article/details/47775831
linux下 Apache 配置虚拟主机三种方式
https://blog.csdn.net/yingzhaom/article/details/78604486
https://blog.csdn.net/u010175124/article/details/18220495
https://blog.csdn.net/a_onebei/article/details/27838049
https://jingyan.baidu.com/article/647f0115906ae87f2148a885.html
https://zhuanlan.zhihu.com/p/29741703
http://www.cnblogs.com/lzrabbit/archive/2013/03/05/2944804.html

#虚拟主机配置
***网站不要设置在root目录下

关掉selinux之后:Starting httpd: Warning: DocumentRoot [/root/kwww/w1] does not exist故障消失
加NameVirtualHost 10.6.6.7:80之后"perhaps you need a NameVirtualHost directive"故障消失
加上ServerName 10.6.6.7:80之后httpd启动彻底好了--->
---->无下面报警了httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName)

vi /etc/hosts
10.6.6.7  www.karter.com  www.k1.com  www.k2.com

httpd.conf
Listen 10.6.6.7:80
Include conf.d/*.conf

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make 
# redirections work in a sensible way.

#ServerName www.example.com:80
ServerName 10.6.6.7:80

#DocumentRoot "/var/www/html"

#Aliases: Add here as many aliases as you need (with no limit). The format is 
# Alias fakename realname
Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
# Use name-based virtual hosting.
NameVirtualHost 10.6.6.7:80

NOTE: NameVirtualHost cannot be used without a port specifier 
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.

 VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost 10.6.6.7:80>
DocumentRoot /var/www/html
ServerName www.karter.com
</VirtualHost>

<VirtualHost 10.6.6.7:80>
DocumentRoot /home/kwww/w1
ServerName www.k1.com
</VirtualHost>

<VirtualHost 10.6.6.7:80>
DocumentRoot /home/kwww/w2
ServerName www.k2.com
</VirtualHost>

#实验虚拟目录,用以下的方法不成功,理解错了。虚拟主机是一个服务器建立多个网站 ,
虚拟目录是一个网站中多个目录对其起别名的意思(alias命令,缩短访问的url)

---the end---