亚洲韩日午夜视频,欧美日韩在线精品一区二区三区,韩国超清无码一区二区三区,亚洲国产成人影院播放,久草新在线,在线看片AV色

您好,歡迎來到思海網(wǎng)絡(luò),我們將竭誠為您提供優(yōu)質(zhì)的服務(wù)! 誠征網(wǎng)絡(luò)推廣 | 網(wǎng)站備案 | 幫助中心 | 軟件下載 | 購買流程 | 付款方式 | 聯(lián)系我們 [ 會員登錄/注冊 ]
促銷推廣
客服中心
業(yè)務(wù)咨詢
有事點擊這里…  531199185
有事點擊這里…  61352289
點擊這里給我發(fā)消息  81721488
有事點擊這里…  376585780
有事點擊這里…  872642803
有事點擊這里…  459248018
有事點擊這里…  61352288
有事點擊這里…  380791050
技術(shù)支持
有事點擊這里…  714236853
有事點擊這里…  719304487
有事點擊這里…  1208894568
有事點擊這里…  61352289
在線客服
有事點擊這里…  531199185
有事點擊這里…  61352288
有事點擊這里…  983054746
有事點擊這里…  893984210
當前位置:首頁 >> 技術(shù)文章 >> 文章瀏覽
技術(shù)文章

如何更改apache服務(wù)器配置

添加時間:2011-2-19  添加: admin 

RedHat Enterprise Linux 5通過yum安裝好httpd服務(wù)器,需要更改很多默認的選項以便滿足我們更多的需要,現(xiàn)在就重點講一下更改httpd服務(wù)器的哪些必要參數(shù):

1,編輯apache的配置文件,
[root@www ~]# vi /etc/httpd/conf/httpd.conf
2,ServerTokens OS  ← 找到這一行,將“OS”改為“Prod”(在出現(xiàn)錯誤頁的時候不顯示服務(wù)器操作系統(tǒng)的名稱)
 ↓
ServerTokens Prod   ← 變?yōu)榇藸顟B(tài)
3,ServerSignature On  ← 找到這一行,將“On”改為“Off”
 ↓
ServerSignature Off  ← 在錯誤頁中不顯示Apache的版本
4,ServerAdmin root@localhost  ← 將管理員郵箱設(shè)置為自己常用的郵箱
 ↓
ServerAdmin zy66289214@126.com  ← 根據(jù)實際情況修改默認設(shè)置
5,#ServerName new.host.name:80  ← 修改主機名
 ↓
ServerName www.hello521.com:80  ← 根據(jù)實際情況修改,端口號保持默認的80
6,Options Indexes FollowSymLinks  ← 找到這一行,刪除“Indexes”,并添加“Includes”、“ExecCGI”
 ↓
Options Includes ExecCGI FollowSymLinks  ← 允許服務(wù)器執(zhí)行CGI及SSI
7,#AddHandler cgi- .cgi  ← 找到這一行,去掉行首的“#”,并在行尾添加“.pl”
 ↓
AddHandler cgi- .cgi .pl  ← 允許擴展名為.pl的CGI腳本運行
8,AllowOverride None  ← 找到這一行,將“None”改為“All”↓
AllowOverride All  ← 變?yōu)榇藸顟B(tài),允許.htaccess
9,LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined  ← 找到這一行
 ↓
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined  ← 改為此狀態(tài)(添加“!414”到規(guī)則中,對于過長的日志不記錄)
10,AddDefaultCharset UTF-8  ← 找到這一行,在行首添加“#”
 ↓
#AddDefaultCharset UTF-8  ← 不使用UTF-8作為網(wǎng)頁的默認編碼AddDefaultCharset GB2312  ← 并接著添加這一行(添加GB2312為

默認編碼)
11,<Directory "/var/www/icons">  ← 找到這一個標簽,并在標簽中更改相應(yīng)選項
  Options Indexes MultiViews  ← 找到這一行,將“Indexes”刪除
    ↓
  Options MultiViews   ← 變?yōu)榇藸顟B(tài)(不在瀏覽器上顯示樹狀目錄結(jié)構(gòu))
12,刪除測試頁
[root@www ~]# rm -rf /etc/httpd/conf.d/welcome.conf

/var/www/error/noindex.html
13,設(shè)置開機自啟動
[root@www ~]# chkconfig --list httpd
httpd           0:關(guān)閉   1:關(guān)閉   2:關(guān)閉   3:關(guān)閉   4:關(guān)閉   5:關(guān)閉   6:關(guān)閉
[root@www ~]# chkconfig httpd on
[root@www ~]# chkconfig --list httpd
httpd           0:關(guān)閉   1:關(guān)閉   2:啟用   3:啟用   4:啟用   5:啟用   6:關(guān)閉
14,[root@www ~]# service httpd restart 從新啟動httpd以更改

新的配置
15,建立測試頁
[root@www ~]# vi /var/www/html/index.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=GB2312">
<title>Hello,World!</title>
<body>
Hello,歡迎加入linux 企業(yè)討論群13275765
</body>
</html>
在客戶端輸入 http://192.168.1.11 請對應(yīng)自己的服務(wù)器地址建議

使用火狐瀏覽器,如果不能正確顯示中文請修改火狐瀏覽器的utf8
[root@www ~]# rm -rf /var/www/html/index.html 刪除測試頁
16.測試php
[root@www ~]# vi /var/www/html/test.php
<?php
phpinfo();
?>
在客戶端輸入 http://192.168.1.11/test.php 請對應(yīng)自己的服務(wù)器地址
17,測試cgi
[root@www ~]# vi /var/www/html/test.cgi
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "<html><body>";
print "Hello,World!CGI is working!<br>";
print "</body></html>";
[root@www ~]# chmod 755 /var/www/html/test.cgi
在客戶端輸入 http://192.168.1.11/test.cgi 請對應(yīng)自己的服務(wù)器地址

18,對SSI進行測試

[root@www ~]# vi /var/www/html/test.shtml  ← 建立SSI測試頁,內(nèi)容如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=GB2312">
<title>Hello,World!</title>
<body>
TEST SSI
<!--#config timefmt="%Y/%m/%d %H:%M:%S" -->
<!--#echo var="DATE_LOCAL" -->
</body>
</html>
在客戶端輸入 http://192.168.1.11/shtml
19,5] 對.htaccess的支持進行測試

[root@sample ~]# vi /var/www/html/index.shtml  ← 建立.htaccess測試用的頁,內(nèi)容如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=GB2312">
<title>Hello,World!</title>
<body>
The name of the file is <!--#echo var="DOCUMENT_NAME" -->
</body>
</html>

  然后在瀏覽器中輸入“http://192.168.1.11,如果顯示“Forbidden”,說明.htaccess正常。然后建立一個.htaccess文件,并定義相應(yīng)規(guī)則,如下:

[root@sample html]# vi /var/www/html/.htaccess  ← 建立.htaccess文件,內(nèi)容如下:

DirectoryIndex index.shtml
然后在瀏覽器中輸入“http://192.168.1.11如果正確顯示“ The name of the file is index.shtml”,說明.htaccess中的規(guī)則生效

狀態(tài),OK。
20 刪除測試用的文件
[root@www ~]# rm -f /var/www/html/* /var/www/html/.htaccess


關(guān)鍵詞:測試   關(guān)閉

分享到:

頂部 】 【 關(guān)閉
版權(quán)所有:佛山思海電腦網(wǎng)絡(luò)有限公司 ©1998-2024 All Rights Reserved.
聯(lián)系電話:(0757)22630313、22633833
中華人民共和國增值電信業(yè)務(wù)經(jīng)營許可證: 粵B1.B2-20030321 備案號:粵B2-20030321-1
網(wǎng)站公安備案編號:44060602000007 交互式欄目專項備案編號:200303DD003  
察察 工商 網(wǎng)安 舉報有獎  警警  手機打開網(wǎng)站