LINUX下的APACHE的配置
生活随笔
收集整理的這篇文章主要介紹了
LINUX下的APACHE的配置
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
今天寫(xiě)一下LINUX下的APACHE的配置方法。
APACHE是作為WEB服務(wù)器的。它的優(yōu)點(diǎn)在于用緩存方式來(lái)加快網(wǎng)頁(yè)的搜索速度。
APACHE缺省只支持靜態(tài)網(wǎng)頁(yè)
LINUX下有APACHE的RPM包
安裝上第一張盤(pán)里的httpd-2.0.40-21.i386.rpm 包
1 /etc/httpd/conf.d 放在這里的都是動(dòng)態(tài)網(wǎng)頁(yè)的配置文件
2 /etc/httpd/conf/httpd.conf 主配置文件
3 /var/log/httpd?? 日志文件目錄。
4 /var/www/html 網(wǎng)頁(yè)的存放目錄
5 /etc/rc.d/init.d 工具文件目錄。
6 vi /etc/httpd/conf/httpd.conf
?
? Section 1: Global Environment(全局設(shè)置)
?
?ServerRoot "/etc/httpd" (APACHE安裝路徑)
?DirectoryIndex index.html index.html.var (網(wǎng)頁(yè)首頁(yè)的第一頁(yè))
?Timeout 300 (超出時(shí)間)
?KeepAlive Off(保持Httpd激活)
?MaxKeepAliveRequests 100 (保持的連接的人數(shù),改成0就是說(shuō)沒(méi)有人數(shù)的限制)
?KeepAliveTimeout 15 (保持激活的超出時(shí)間)
?prefork MPM (預(yù)派生模式)
?worker MPM (工作者模式)
?Listen 80 (偵聽(tīng)的端口)
?LoadModule (加載模塊) Section 2: 'Main' server configuration(服務(wù)器配置)
? User apache Group apache (由誰(shuí)啟動(dòng)APACHE服務(wù)器)
? ServerAdmin root@localhost (網(wǎng)頁(yè)出錯(cuò)給誰(shuí)發(fā)信通知)
? ServerName new.host.name:80(設(shè)置網(wǎng)站的域名)
? DocumentRoot "/var/www/html"(網(wǎng)頁(yè)存放的路徑)
? <Directory /> (目錄容器)
? Options (選項(xiàng)) FollowSymLinks(允許符號(hào)連接,允許這個(gè)網(wǎng)頁(yè)以外的地方)
? AccessFileName .htaccess(訪問(wèn)文件定義名稱(chēng)文件容器)
? <Files ~ "^\.ht"> 想把所有以 .ht 開(kāi)頭的文件做限制
??? Order allow,deny 定義訪問(wèn)順序 先允許,后拒絕
??? Deny from all? 拒絕所有人
</Files> Section 3: Virtual Hosts (虛擬主機(jī))
??
? NameVirtualHost * (虛擬主機(jī)工作的IP)
? ServerAdmin [email]webmaster@dummy-host.example.com[/email] (虛擬主機(jī)的管理員的郵件地址)
? DocumentRoot /www/docs/dummy-host.example.com (網(wǎng)頁(yè)放在那)
? ServerName dummy-host.example.com (主機(jī)名是什么)
? ErrorLog logs/dummy-host.example.com-error_log(錯(cuò)誤日記路徑)
? CustomLog logs/dummy-host.example.com-access_log common(訪問(wèn)日志路徑)? 1 基于IP的虛擬主機(jī)
? 1 NameVirtualHost * 放開(kāi)
? 2 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
?? </VirtualHost>
? 3 <VirtualHost 192.168.0.13:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost>
2 基于端口的虛擬主機(jī)
? 1 NameVirtualHost 192.168.0.12 放開(kāi)
? 2 <VirtualHost 192.168.0.12:8080>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
??? </VirtualHost>
? 3 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost>
3 基于主機(jī)頭的虛擬主機(jī)
?
? 1 NameVirtualHost 192.168.0.12:80 放開(kāi)
? 2 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
??? </VirtualHost>
? 3 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost> 4 做虛擬目錄的認(rèn)證 1找到 /Alias? 2 Alias /xinwe/ "/usr/web1" <Directory "/usr/web1">
??? Options Indexes MultiViews
??? AllowOverride None
??? Order allow,deny
??? Allow from all
??? AuthName "huiyuan"
??? AuthType Basic
??? AuthUserFile /etc/pass
??? require valid-user tom1 tom2
</Directory> 3 htpasswd -c /etc/pass tom1
4 htpasswd -c /etc/pass tom2
5 chown apache.apache /etc/pass
6 service httpd reload 另一種方式也可以實(shí)現(xiàn)做虛擬目錄的認(rèn)證 1 找到 /Alias
2 Alias /xinwe/ "/usr/web1"
? <Directory "/usr/web1">
????? AllowOverride AuthConfig
? </Directory>
3 然后在/usr/web1文件夾下touch .htaccess 文本文件
4 vi /usr/web1/.htaccess 在里面寫(xiě)入
??? Options Indexes MultiViews
??? Order allow,deny
??? Allow from all
??? AuthName "huiyuan"
??? AuthType Basic
??? AuthUserFile /etc/pass
??? require valid-user tom1 tom2
5 chown apache.apache /etc/pass
? htpasswd -c /etc/pass tom1
? htpasswd -c /etc/pass tom2
? service httpd reload APACHE有代理局域網(wǎng)上網(wǎng)的功能 把前面的#去掉
#<IfModule mod_proxy.c>
#ProxyRequests On? (當(dāng)?shù)扔贠N的時(shí)候說(shuō)明打開(kāi)代理)
#<Proxy *>
#??? Order deny,allow (把它改成Order allow,deny,)
#??? Deny from all? (把它改成Allow from all)
#??? Allow from .your-domain.com? (局域網(wǎng)網(wǎng)段比如:Allow from 192.168.0.0/24)
#</Proxy> #ProxyVia On (讓代理支持http) #CacheRoot "/etc/httpd/proxy" (緩存的路徑)
#CacheSize 5 (緩存的大小)
#CacheGcInterval 4
#CacheMaxExpire 24 (緩存最大的過(guò)期時(shí)間)
#CacheLastModifiedFactor 0.1
#CacheDefaultExpire 1 (最短的過(guò)期時(shí)間)
#NoCache a-domain.com another-domain.edu joes.garage-sale.com (不緩存那些域名)
?
客戶端改IE 依次 工具--Internet選項(xiàng)--連接--局域網(wǎng)設(shè)置--勾上為L(zhǎng)AN使用使用代理服務(wù)器--填寫(xiě)APACHE主機(jī)的
IP地址比如:192.168.0.20 端口:80 到這里APACHE的配置講完了. 希望看完我的配置你可以配置網(wǎng)站的服務(wù)器! LINUX 職場(chǎng) APACHE 系統(tǒng)知識(shí)
APACHE是作為WEB服務(wù)器的。它的優(yōu)點(diǎn)在于用緩存方式來(lái)加快網(wǎng)頁(yè)的搜索速度。
APACHE缺省只支持靜態(tài)網(wǎng)頁(yè)
LINUX下有APACHE的RPM包
安裝上第一張盤(pán)里的httpd-2.0.40-21.i386.rpm 包
1 /etc/httpd/conf.d 放在這里的都是動(dòng)態(tài)網(wǎng)頁(yè)的配置文件
2 /etc/httpd/conf/httpd.conf 主配置文件
3 /var/log/httpd?? 日志文件目錄。
4 /var/www/html 網(wǎng)頁(yè)的存放目錄
5 /etc/rc.d/init.d 工具文件目錄。
6 vi /etc/httpd/conf/httpd.conf
?
? Section 1: Global Environment(全局設(shè)置)
?
?ServerRoot "/etc/httpd" (APACHE安裝路徑)
?DirectoryIndex index.html index.html.var (網(wǎng)頁(yè)首頁(yè)的第一頁(yè))
?Timeout 300 (超出時(shí)間)
?KeepAlive Off(保持Httpd激活)
?MaxKeepAliveRequests 100 (保持的連接的人數(shù),改成0就是說(shuō)沒(méi)有人數(shù)的限制)
?KeepAliveTimeout 15 (保持激活的超出時(shí)間)
?prefork MPM (預(yù)派生模式)
?worker MPM (工作者模式)
?Listen 80 (偵聽(tīng)的端口)
?LoadModule (加載模塊) Section 2: 'Main' server configuration(服務(wù)器配置)
? User apache Group apache (由誰(shuí)啟動(dòng)APACHE服務(wù)器)
? ServerAdmin root@localhost (網(wǎng)頁(yè)出錯(cuò)給誰(shuí)發(fā)信通知)
? ServerName new.host.name:80(設(shè)置網(wǎng)站的域名)
? DocumentRoot "/var/www/html"(網(wǎng)頁(yè)存放的路徑)
? <Directory /> (目錄容器)
? Options (選項(xiàng)) FollowSymLinks(允許符號(hào)連接,允許這個(gè)網(wǎng)頁(yè)以外的地方)
? AccessFileName .htaccess(訪問(wèn)文件定義名稱(chēng)文件容器)
? <Files ~ "^\.ht"> 想把所有以 .ht 開(kāi)頭的文件做限制
??? Order allow,deny 定義訪問(wèn)順序 先允許,后拒絕
??? Deny from all? 拒絕所有人
</Files> Section 3: Virtual Hosts (虛擬主機(jī))
??
? NameVirtualHost * (虛擬主機(jī)工作的IP)
? ServerAdmin [email]webmaster@dummy-host.example.com[/email] (虛擬主機(jī)的管理員的郵件地址)
? DocumentRoot /www/docs/dummy-host.example.com (網(wǎng)頁(yè)放在那)
? ServerName dummy-host.example.com (主機(jī)名是什么)
? ErrorLog logs/dummy-host.example.com-error_log(錯(cuò)誤日記路徑)
? CustomLog logs/dummy-host.example.com-access_log common(訪問(wèn)日志路徑)? 1 基于IP的虛擬主機(jī)
? 1 NameVirtualHost * 放開(kāi)
? 2 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
?? </VirtualHost>
? 3 <VirtualHost 192.168.0.13:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost>
2 基于端口的虛擬主機(jī)
? 1 NameVirtualHost 192.168.0.12 放開(kāi)
? 2 <VirtualHost 192.168.0.12:8080>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
??? </VirtualHost>
? 3 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost>
3 基于主機(jī)頭的虛擬主機(jī)
?
? 1 NameVirtualHost 192.168.0.12:80 放開(kāi)
? 2 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@yirehe.com[/email]
??? DocumentRoot /web1
??? ServerName [url]www.yirehe.com[/url]
??? ErrorLog logs/www.yirehe.com-error_log
??? CustomLog logs/www.yirehe.com-access_log common
??? </VirtualHost>
? 3 <VirtualHost 192.168.0.12:80>
??? ServerAdmin [email]webmaster@zuanmou.com[/email]
??? DocumentRoot /web2
??? ServerName [url]www.zuanmou.com[/url]
??? ErrorLog logs/www.zuanmou.com-error_log
??? CustomLog logs/www.zuanmou.com-access_log common
??? </VirtualHost> 4 做虛擬目錄的認(rèn)證 1找到 /Alias? 2 Alias /xinwe/ "/usr/web1" <Directory "/usr/web1">
??? Options Indexes MultiViews
??? AllowOverride None
??? Order allow,deny
??? Allow from all
??? AuthName "huiyuan"
??? AuthType Basic
??? AuthUserFile /etc/pass
??? require valid-user tom1 tom2
</Directory> 3 htpasswd -c /etc/pass tom1
4 htpasswd -c /etc/pass tom2
5 chown apache.apache /etc/pass
6 service httpd reload 另一種方式也可以實(shí)現(xiàn)做虛擬目錄的認(rèn)證 1 找到 /Alias
2 Alias /xinwe/ "/usr/web1"
? <Directory "/usr/web1">
????? AllowOverride AuthConfig
? </Directory>
3 然后在/usr/web1文件夾下touch .htaccess 文本文件
4 vi /usr/web1/.htaccess 在里面寫(xiě)入
??? Options Indexes MultiViews
??? Order allow,deny
??? Allow from all
??? AuthName "huiyuan"
??? AuthType Basic
??? AuthUserFile /etc/pass
??? require valid-user tom1 tom2
5 chown apache.apache /etc/pass
? htpasswd -c /etc/pass tom1
? htpasswd -c /etc/pass tom2
? service httpd reload APACHE有代理局域網(wǎng)上網(wǎng)的功能 把前面的#去掉
#<IfModule mod_proxy.c>
#ProxyRequests On? (當(dāng)?shù)扔贠N的時(shí)候說(shuō)明打開(kāi)代理)
#<Proxy *>
#??? Order deny,allow (把它改成Order allow,deny,)
#??? Deny from all? (把它改成Allow from all)
#??? Allow from .your-domain.com? (局域網(wǎng)網(wǎng)段比如:Allow from 192.168.0.0/24)
#</Proxy> #ProxyVia On (讓代理支持http) #CacheRoot "/etc/httpd/proxy" (緩存的路徑)
#CacheSize 5 (緩存的大小)
#CacheGcInterval 4
#CacheMaxExpire 24 (緩存最大的過(guò)期時(shí)間)
#CacheLastModifiedFactor 0.1
#CacheDefaultExpire 1 (最短的過(guò)期時(shí)間)
#NoCache a-domain.com another-domain.edu joes.garage-sale.com (不緩存那些域名)
?
客戶端改IE 依次 工具--Internet選項(xiàng)--連接--局域網(wǎng)設(shè)置--勾上為L(zhǎng)AN使用使用代理服務(wù)器--填寫(xiě)APACHE主機(jī)的
IP地址比如:192.168.0.20 端口:80 到這里APACHE的配置講完了. 希望看完我的配置你可以配置網(wǎng)站的服務(wù)器! LINUX 職場(chǎng) APACHE 系統(tǒng)知識(shí)
0
微博 QQ 微信收藏
上一篇:linux中建立網(wǎng)站服務(wù)器詳解 下一篇:Linux快速構(gòu)建apache ... lanyue2492篇文章,22W+人氣,0粉絲
Ctrl+Enter?發(fā)布
發(fā)布
取消
1條評(píng)論
按時(shí)間倒序 按時(shí)間正序推薦專(zhuān)欄更多
VMware vSAN中小企業(yè)應(yīng)用案例掌握VMware超融合技術(shù)
共41章?|?王春海
¥51.00 346人訂閱
訂???閱 基于Kubernetes企業(yè)級(jí)容器云平臺(tái)落地與實(shí)踐容器私有云平臺(tái)實(shí)踐之路
共15章?|?李振良OK
¥51.00 596人訂閱
訂???閱 網(wǎng)工2.0晉級(jí)攻略 ——零基礎(chǔ)入門(mén)Python/Ansible網(wǎng)絡(luò)工程師2.0進(jìn)階指南
共30章?|?姜汁啤酒
¥51.00 1566人訂閱
訂???閱 負(fù)載均衡高手煉成記高并發(fā)架構(gòu)之路
共15章?|?sery
¥51.00 507人訂閱
訂???閱 帶你玩轉(zhuǎn)高可用前百度高級(jí)工程師的架構(gòu)高可用實(shí)戰(zhàn)
共15章?|?曹林華
¥51.00 462人訂閱
訂???閱猜你喜歡
我的友情鏈接 Cisco路由配置語(yǔ)句匯總 使用iLO遠(yuǎn)程管理HP系列服務(wù)器 搭建ELK日志分析平臺(tái)(下)—— 搭建kibana和logstash服務(wù)器 CentOS6.4+LAMP+Postfix+Dovecot+Postfixadmin+Roundcubemail 打造企業(yè)級(jí)郵件服務(wù)器 (1) 用Windows Storage Server 2008做iSCSI存儲(chǔ)服務(wù)器 服務(wù)器排障 之 nginx 499 錯(cuò)誤的解決 apache做反向代理服務(wù)器 體驗(yàn)vSphere 6之3-使用vSphere Web Client Windows Server 2012圖形用戶界面(GUI)和服務(wù)器核心(Server Core)之間的切換 Linux運(yùn)維高級(jí)篇—CentOS 7下Postfix郵件服務(wù)器搭建 最新免費(fèi)HTTP代理服務(wù)器地址 簡(jiǎn)述centOS 7系統(tǒng)用戶和組的管理及配置 解析DELL R710服務(wù)器遷移操作內(nèi)容 開(kāi)學(xué)季出大事:某教育局丟失3臺(tái)虛擬機(jī) EVA4400存儲(chǔ)虛擬機(jī)+數(shù)據(jù)庫(kù)數(shù)據(jù)恢復(fù)成功案例 服務(wù)器數(shù)據(jù)恢復(fù)通用方法+服務(wù)器分區(qū)丟失恢復(fù)案例 在CentOS7上部署squid緩存服務(wù)器及代理功能 EMC 5400服務(wù)器raid陣列癱瘓數(shù)據(jù)恢復(fù)成功案例 服務(wù)器數(shù)據(jù)恢復(fù)案例 / raid5陣列多塊硬盤(pán)離線處理方法掃一掃,領(lǐng)取大禮包
1
1 分享 lanyue24轉(zhuǎn)載于:https://blog.51cto.com/lanyue24/30993
總結(jié)
以上是生活随笔為你收集整理的LINUX下的APACHE的配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python 安装win32com_py
- 下一篇: Linux下jdk配置环境变量