六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學習啦>學習電腦>電腦安全>網(wǎng)絡(luò)安全知識>

網(wǎng)站服務器Apache的常用配置

時間: 林澤1002 分享

  工作中用到了Apache服務器-這個世界排名第一的傳奇服務器,它功能強大,倍受青睞。作為靜態(tài)頁面首選服務器,那么它具體是怎么用的呢。下面是學習啦小編跟大家分享的是網(wǎng)站服務器Apache的常用配置,歡迎大家來閱讀學習。

  網(wǎng)站服務器Apache的常用配置

  方法/步驟

  1首先打開Apache安裝目錄中的conf目錄下httpd.conf文件(如D:\Apache2.2\conf\httpd.conf)。

  21、配置網(wǎng)站默認發(fā)布路徑。

  默認情況下,Apache的發(fā)布路徑是安裝目錄下的htdocs目錄,但通常情況我們需要讓它指向我們自己的網(wǎng)站目錄(如d:/web)。

  方法如下:

  Ctrl+F查找“DocumentRoot”,

  會找到它的默認發(fā)布路徑:DocumentRoot "D:/Apache2.2/htdocs"。

  修改該默認路徑為:DocumentRoot "d:/web"即可。

  2、讓apache支持shtml文件,實現(xiàn)include文件解析。

  (1)確認加載include.so模塊,將注釋去掉。

  LoadModule include_module modules/mod_include.so

  (2)AddType部分去掉這兩段注釋:

  AddType text/html .shtml

  AddOutputFilter INCLUDES .shtml

  (3)目錄權(quán)限里找到Options Indexes FollowSymLinks,增加Includes

  修改為:Options Indexes FollowSymLinks Includes。

  (4)重啟apache。

  測試:???? SSI ????????

  3、添加默認文檔index.htm。

  查找:DirectoryIndex index.html

  替換為:DirectoryIndex index.html index.htm

  4、設(shè)置404頁面。

  辦法一:

  (1)在網(wǎng)站根目錄下建立.htaccess文件,新建一個文本,然后用壓縮軟件壓縮此文本,在壓縮文件名處輸入 .htaccess。

  (2)開啟.htaccess配置功能:在httpd.conf中設(shè)置對目錄開啟。AllowOverride All

  (3)打開.htacccess文件添加以下信息:ErrorDocument 404 /404.html

  (4)在網(wǎng)站根目錄下新建404.html頁面。

  辦法二:

  

  DocumentRoot "F:\www\abc.com"

  ServerName www.abc.com

  

  Options Indexes FollowSymLinks Includes ExecCGI

  AllowOverride

  AllOrder allow,deny

  Allow from all

  

  ErrorDocument 404 /404.html

  

  5、禁止目錄瀏覽:

  方法一:

  將Options Indexes FollowSymLinks修改為Options -Indexes FollowSymLinks。

  方法二:

  在.htaccess文件中輸入

  Options -Indexes

  6、配置二級域名:

  NameVirtualHost *:80(這個必加,否則二級域名訪問會跳轉(zhuǎn)到頂級域名)

  

  ServerAdmin administrator

  DocumentRoot "d:/web/wapcn"

  ServerName wapcn.xxx.com

  

  

  ServerAdmin administrator

  DocumentRoot "d:/web/wapen"

  ServerName wapen.xxx.com

  

  

  ServerAdmin administrator

  DocumentRoot "d:/web/weben"

  ServerName en.xxx.com

  

  

  ServerAdmin administrator

  DocumentRoot "d:/web/webcn"

  ServerName www.xxx.com

  

  7、Apahce解決中文亂碼問題:

  AddDefaultCharset ISO-8859-1

  修改為AddDefaultCharset off

  或修改為AddDefaultCharset GB2312

  或修改為AddDefaultCharset UTF-8

  8、apache加大網(wǎng)站并發(fā)量:

  

  ThreadsPerChild 1000

  MaxRequestsPerChild 10000

  Win32DisableAcceptEx

  

  9、apache加大線程數(shù):

  

  ThreadsPerChild 512

  MaxRequestsPerChild 0

  

  10、Apache 按天生成日志

  (1)打開httpd.conf配置文件找到: CustomLog "logs/access.log" common

  (2)將其改為:CustomLog "|bin/rotatelogs.exe logs/%Y_%m_%d.access.log 86400 480" common

  (3)打開httpd.conf配置文件找到: ErrorLog "logs/error.log"

  (4)將其改為:ErrorLog "|bin/rotatelogs.exe logs/%Y_%m_%d.error.log 86400 480"

  11、開啟apache網(wǎng)頁監(jiān)控

  刪除LoadModule status_module modules/mod_status.so前面的#號。

  在httpd.conf中加入:

  

  SetHandler server-status

  Order Deny,Allow

  Deny from nothing

  Allow from all

  

  ExtendedStatus On

  訪問http://IP:端口/server-status。

2682696