#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 [email protected] # 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 [email protected] # 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---
apache httpd
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.