首页 电脑 电脑学堂 查看内容

Apache conf文件说明

2011-10-17 20:55 465 0

摘要:   #每个子进程建立的线程数  ThreadsPerChild 500  #最大连接数  MaxClients 15  #每个连接最大请求数  MaxRequestsPerChild  10...
关键词: nbsp LoadModule MODULES module mod python so apache IndexOptions 文件

  #每个子进程建立的线程数  ThreadsPerChild 500  #最大连接数  MaxClients 15  #每个连接最大请求数  MaxRequestsPerChild  100  #连接超时  Timeout 30  #HTTP持久链接  KeepAlive Off  #一个持久链接中允许的最大请求数量  MaxKeepAliveRequests 100  #持久链接中服务器在两次请求之间等待的秒数  KeepAliveTimeout 5  #配置服务器如何确定它自己的域名和端口  #UseCanonicalName Off  #现实apache信息在错误页面  ServerSignature on  #对客户端IP的DNS查找  HostnameLookups Off  #AddDefaultCharset UTF-8 ← 不使用UTF-8作为网页的默认编码  #AddDefaultCharset GB2312 ← 并接着添加这一行(添加GB2312为默认编码)  ServerRoot "d:/APM/Apache"  Listen 80  #user apache  #group apache  #查看apache加载那些模块  #httpd  -l  内核编译  #httpd  -t -D DUMP_MODULES  LoadModule actions_module modules/mod_actions.so  LoadModule alias_module modules/mod_alias.so  LoadModule asis_module modules/mod_asis.so  LoadModule auth_basic_module modules/mod_auth_basic.so  #LoadModule auth_digest_module modules/mod_auth_digest.so  #LoadModule authn_anon_module modules/mod_authn_anon.so  #LoadModule authn_dbm_module modules/mod_authn_dbm.so  LoadModule authn_default_module modules/mod_authn_default.so  LoadModule authn_file_module modules/mod_authn_file.so  #LoadModule authz_dbm_module modules/mod_authz_dbm.so  LoadModule authz_default_module modules/mod_authz_default.so  LoadModule authz_groupfile_module modules/mod_authz_groupfile.so  LoadModule authz_host_module modules/mod_authz_host.so  LoadModule authz_user_module modules/mod_authz_user.so  LoadModule autoindex_module modules/mod_autoindex.so  #LoadModule cern_meta_module modules/mod_cern_meta.so  LoadModule cgi_module modules/mod_cgi.so  #LoadModule dav_fs_module modules/mod_dav_fs.so  #LoadModule deflate_module modules/mod_deflate.so  LoadModule dir_module modules/mod_dir.so  LoadModule env_module modules/mod_env.so  #LoadModule expires_module modules/mod_expires.so  #LoadModule file_cache_module modules/mod_file_cache.so  #LoadModule headers_module modules/mod_headers.so  LoadModule imagemap_module modules/mod_imagemap.so  LoadModule include_module modules/mod_include.so  #LoadModule info_module modules/mod_info.so  LoadModule isapi_module modules/mod_isapi.so  LoadModule log_config_module modules/mod_log_config.so  LoadModule mime_module modules/mod_mime.so  LoadModule mime_magic_module modules/mod_mime_magic.so  LoadModule proxy_module modules/mod_proxy.so  #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so  #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so  #LoadModule proxy_connect_module modules/mod_proxy_connect.so  LoadModule proxy_http_module modules/mod_proxy_http.so  #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so  LoadModule negotiation_module modules/mod_negotiation.so  LoadModule rewrite_module modules/mod_rewrite.so  LoadModule setenvif_module modules/mod_setenvif.so  #LoadModule speling_module modules/mod_speling.so  LoadModule status_module modules/mod_status.so  #LoadModule unique_id_module modules/mod_unique_id.so  LoadModule userdir_module modules/mod_userdir.so  #LoadModule usertrack_module modules/mod_usertrack.so  LoadModule vhost_alias_module modules/mod_vhost_alias.so  LoadModule ssl_module modules/mod_ssl.so  #LoadModule dav_module modules/mod_dav.so  #LoadModule python_module modules/mod_python.so  ServerAdmin  [email protected]  ServerName 220.194.47.101  #设置ico  Alias /icons/ "D:/APM/Apache/icons"  <Directory "D:/APM/Apache/icons">  Options Indexes MultiViews  AllowOverride None  Order allow,deny  Allow from all  </Directory>  <IfModule dir_module>  DirectoryIndex index.html index.php  </IfModule>  #包含作用于与正则表达式匹配的文件名的指令  <FilesMatch "^\.ht">  Order allow,deny  Deny from all  </FilesMatch>  #开启服务器信息  ExtendedStatus On  <Location /server-status>  SetHandler server-status  Order deny,allow  Allow from all  </Location>  #=================加载python============================  #mod_python 安装加载!  #./configure --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/bin/python2.2  #make && make install  #LoadModule python_module modules/mod_python.so  #加载python  # 设置python 脚本  <Directory /some/directory/htdocs/test>  # 开启python 支持!  AddHandler mod_python .py  PythonHandler test  PythonDebug On  #Apache python cgi ****************  #Options FollowSymLinks ExecCGI  #Options Includes ExecCGI FollowSymLinks ← 允许服务器执行CGI及SSI  #Order Deny,Allow  #AddHandler cgi-script .cgi .py  </Directory>  ######MaxRequestsPerChild 1 #这样可以在开发阶段不用重启Apache进行测试###  #两个例子!  #test.py *******************  #from mod_python import apache  #def handler(req):  #   req.content_type = "text/plain"  #   req.write("Hello World!")  #   return apache.OK  #hello.py****************************  #!d:\python25\python.exe  #import cgi  #print "Content-type: text/plain; charset=iso-8859-1 "  #print 'Hello python cgi'  #django**********************  #<Location "/">  #SetHandler python-program  #PythonPath "['D:/python25/'] + sys.path"  #PythonHandler django.core.handlers.modpython  #SetEnv DJANGO_SETTINGS_MODULE demo.settings  #PythonDebug On  #===================================================================  #=========================https ssl加密 ============================  Listen 443  AddType application/x-x509-ca-cert .crt  AddType application/x-pkcs7-crl    .crl  SSLPassPhraseDialog  builtin  SSLSessionCache         dbm:logs/ssl.scache  SSLSessionCacheTimeout  300  SSLMutex  default  #目录转向  #<VirtualHost  220.194.47.101:80>  #ServerName 220.194.47.101  #RewriteEngine on  #RewriteRule ^(.*)$  https://220.194.47.101$1 [R=301,L]  #301跳转  #</VirtualHost>  NameVirtualHost *:443  <VirtualHost *:443>  ServerName 220.194.47.101  #   General setup for the virtual host  DocumentRoot "D:/apm/www/www"  ServerName *  ServerAdmin webmaster@localhost  SSLEngine on  SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL  SSLCertificateFile conf/server.crt  SSLCertificateKeyFile conf/server.key  </VirtualHost>  #1、生成RSA密钥的方法  #openssl genrsa -des3 -out privkey.pem 2048  #这个命令会生成一个2048位的密钥,同时有一个des3方法加密的密码,  #如果你不想要每次都输入密码,可以改成:  #openssl genrsa -out server.key 2048  #建议用2048位密钥,少于此可能会不安全或很快将不安全。  #2、生成一个证书请求  #openssl req -new -key server.key -out server.csr  #这个命令将会生成一个证书请求,当然,用到了前面生成的密钥server.key文件  #这里将生成一个新的文件server.csr,即一个证书请求文件,你可以拿着这个文件去数字证书颁发机构(即CA)申请一个数字证书。  #CA会给你一个新的文件cacert.csr,那才是你的数字证书。  #如果是自己做测试,那么证书的申请机构和颁发机构都是自己。就可以用下面这个命令来生成证书:  #openssl req -new -x509 -key server.key -out server.csr -days 1095  #这个命令将用上面生成的密钥server.key生成一个数字证书server.csr  #========================================================================================  #=================================加密目录===============================================  #<Directory "D:/APM/www/www">  #    Options FollowSymLinks  #    AllowOverride None  #    Order Deny,Allow  #    Order allow,deny  #    Deny from 123.45.67.8 #禁止ip  #    Deny from 123.123.7  #    Allow from all  #  #    AuthType Basic    #基本认证  #    AuthName "Password Required"   #服务器消息 任意填写  #    AuthUserFile "d:/apm/md5" #这里是绝对路径  #    Require valid-user            #可填写指定用户,现在是密码文件里面所有用户。  #  #    DirectoryIndex index.php #默认文件  # Redirect page1.html page2.html #302跳转  #</Directory>  # 生成密码 htpasswd -b -c d:\apm\www\php\.htpasswd root passwrod  #===================================================================  #设置出错级别  LogLevel warn  ErrorLog logs/error.log  ErrorDocument 403 "You without authorization"  ErrorDocument 404 "Page does not exist"  #日志格式  <IfModule log_config_module>  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined  LogFormat "%h %l %u %t \"%r\" %>s %b" common  <IfModule logio_module>  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio  </IfModule>  </IfModule>  #默认编码  DefaultType text/html  #编码设置  <IfModule mime_module>  TypesConfig conf/mime.types  AddType application/x-compress .Z  AddType application/x-gzip .gz .tgz  AddHandler cgi-script .cgi  </IfModule>  <IfModule ssl_module>  SSLRandomSeed startup builtin  SSLRandomSeed connect builtin  </IfModule>  #加载php  #include "conf/php.conf"  LoadFile /php/php5ts.dll  LoadFile /php/libmysql.dll  LoadModule php5_module /php/php5apache2_2.dll  AddType application/x-httpd-php .html .php  PHPIniDir "d:\apm\php.ini"  <Directory />  Options FollowSymLinks  #开启。htaccess 关闭效率更高  AllowOverride all  Order deny,allow  allow from all  Satisfy all  </Directory>  #设置。htaccess文件名  AccessFileName  .config  #一个 .htaccess 文件控制所在目录, 包括所有子目录。  #放置其他的。htaccess文件在子目录都是无效的。  RewriteLog          logs/rewrite.log  #调试级别  #RewriteLogLevel     5  RewriteLogLevel     0  ####################################################################  #这种方法每次新建虚拟主机要重启apache 虚拟主机少时推荐  #默认虚拟主机  #NameVirtualHost *:80  #目录别名  #Alias /my "D:/APM/www/php"  #<VirtualHost *:80>  # ServerName  www.home.com  # DocumentRoot "D:/APM/www/home"  #</VirtualHost>  #=========================一种不推荐的虚拟主机建立方法==============================  #需要建立与域名同名目录!  #UseCanonicalName Off  #VirtualDocumentRoot D:/APM/www/%0 #设置域名相同目录  #RewriteEngine On  #RewriteCond %{HTTP_HOST} ^w+.w{1,3}$  #RewriteCond %{HTTP_HOST} ^[a-z-0-9]+.w{1,3}$RewriteRule (.*)  http://www.%{HTTP_HOST}$1 [R=301,L]  #=======================================================  #=====================大量虚拟主机建立方法=================================  #打开重写引擎  RewriteEngine       on  #防止跨站攻击  RewriteCond %{REQUEST_METHOD} ^TRACE  RewriteRule .* - [F]  #利用重写建立大量虚拟主机  RewriteMap          lowercase int:tolower  RewriteMap          vhost txt:D:/APM/vhost.map  RewriteCond         ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$  RewriteCond         ${vhost:%1} ^(D:/.*)$  RewriteRule         ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]  #发送apache头  ServerTokens Prod  #vhost.map  #localhost  D:/APM/www/  #域名+空格+绝对路径  #对需要个性化的目录列表进行定制: =======================================  Options Indexes FollowSymlinks  IndexOptions NameWidth=128  IndexOptions DescriptionWidth=128  IndexOptions IconHeight=24  IndexOptions IconWidth=24  IndexOptions FancyIndexing  IndexOptions VersionSort   #Apache会对该文件按照版本号自动排序  IndexOptions FoldersFirst  #最先列出文件夹!  IndexOptions HTMLTable  IndexOptions ScanHTMLTitles  IndexOptions +SuppressHTMLPreamble  #IndexOptions NameWidth=* (Optoional)  #ScanHTMLTitles:搜索HTML标题  #NameWidth:文件命显示字节数  #DescriptionWidth:描述显示字节数  #HTMLTable:允许HTML格式  #FoldersFirst:目录优先  AddType text/html .shtml  #不显示的文件  IndexIgnore header.shtml footer.shtml .config icons  ReadmeName footer.shtml  HeaderName header.shtml  ServerSignature Off  #默认索引排序方式  IndexOrderDefault Ascending Date  #关闭服务器标志  ServerSignature Off  #目录索引文件  DirectoryIndex index.htm  AddDescription "bios设置" awdbedit.7z  #文件描述  IndexOrderDefault Ascending Date  #AllowOverride All  Order allow,deny  Allow from all  AddIconByEncoding (CMP,/soft/icons/compressed.gif) x-compress x-gzip  #AddIconByType (TXT,/soft/icons/text.gif) text/*  #AddIcon /soft/icons/binary.webp .bin .exe  AddIcon /soft/icons/python.webp python  AddIcon /soft/icons/back.gif  AddIcon /soft/icons/hand.right.webp README  AddIcon /soft/icons/folder.webp ^^DIRECTORY^^  AddIcon /soft/icons/blank.webp ^^BLANKICON^^  DefaultIcon /soft/icons/compressed.gif  #header.shtml 设置  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <html xmlns=" http://www.w3.org/1999/xhtml">  <head>  <meta http-equiv="Content-Type" content="text/html; charset=gbk" />  <title>易品轩资料库</title>  </head>  <body>  <div id="header">  <h2>  <a href=" http://www.foods8.com/blog/">  <img src=" http://www.foods8.com/blog/logo.webp" alt="易品轩资料库" />  </a>  </h2>  <div class="ad_header"></div>  </div><!--header end-->  <div  style="width:800px; margin:0 auto;">  <table>  <td>  <tr>  #footer.shtml 设置  </tr>  </td>  </table>  </div>  <div id="footer">  <div class="copyright">  <p><a href=" http://www.miibeian.gov.cn" target="_blank">陕ICP备08104422号</a><br /></p>  </div>  </div><!--footer end-->  #windows安装apache安装技巧  #d:\apm\Apache\bin\httpd.exe -k install -n “服务名” -f “c:\files\my.conf”  #net start Apache2  #net stop apache2  #sc delete apache2  #rem 重启apache  #net stop apache2  #net start apache2
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部