• 关于

    mod_cache

    的搜索结果

问题

刚装的WAMP最新的 外网不能访问啊

nieky 2019-12-01 20:58:24 3743 浏览量 回答数 1

回答

Nginx.conf : user  oschina; worker_processes  2; #error_log  logs/error.log; #error_log  logs/error.log  notice; #error_log  logs/error.log  info; #pid        logs/nginx.pid; events {     use epoll;     worker_connections  2048; } http {     include       mime.types;     default_type  application/octet-stream;     #log_format  main  '$remote_addr - $remote_user [$time_local] $request '     #                  '"$status" $body_bytes_sent "$http_referer" '     #                  '"$http_user_agent" "$http_x_forwarded_for"';     #access_log  off;     access_log  logs/access.log;     client_header_timeout  3m;     client_body_timeout    3m;     send_timeout           3m;       client_header_buffer_size    1k;     large_client_header_buffers  4 4k;     sendfile        on;     tcp_nopush      on;     tcp_nodelay     on;     #keepalive_timeout  75 20;     include    gzip.conf;         server {     listen 80;     server_name .oschina.net;     location / {         rewrite (.*) http://www.oschina.net$1 permanent;     }     }     server {     listen 80;     server_name www.oschina.net my.oschina.net m.oschina.net;         log_format  oschina_log         '$remote_addr - $remote_user [$time_local] $request '         '"$status" $body_bytes_sent "$http_referer" '         '"$http_user_agent" "$http_x_forwarded_for"';         access_log  logs/oschina.log;     location ~ ^/(WEB-INF)/ {             deny all;         }         location ~ .(apk|torrent|htm|html|asp|php|gif|jpg|jpeg|png|bmp|ico|rar|css|js|zip|java|jar|txt|flv|swf|mid|doc|ppt|xls|pdf|txt|mp3|wma)$ {             root /data/oschina/webapp;         access_log off;             expires 24h;         }             location ~ ^/uploads/ {         access_log off;             root /data/oschina/webapp;         expires 24h;         }     location / {         proxy_pass http://localhost:8080;         include proxy.conf;     }     error_page 502 503 /502.html;         error_page 404 /404.html;     error_page 403 /403.html;     } } gzip.conf: gzip              on; gzip_min_length      1000; gzip_types         text/plain text/css application/x-javascript; proxy.conf: proxy_redirect          off; proxy_set_header        Host $host; proxy_set_header        X-Real-IP $remote_addr; proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size    10m; client_body_buffer_size 128k; proxy_connect_timeout   300; proxy_send_timeout      300; proxy_read_timeout      300; proxy_buffer_size       4k; proxy_buffers           4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k;######rewrite (.*) http://www.oschina.net$1 permanent; 这句的意思,是不是访问 http://localhost:8080/oschina 这样的后端 url ,会重定下到 http://localhost/oschina ?######老大回帖真够快的。。。 感谢,正好配一下######engine X与 Tomcat通讯是用8080端口进行 代理proxy是吗? 正则那里还没怎么看懂,看来还得看看engine x的资料补习补习######我也发扬一下风格,这里是我对apache和tomcat的配置: httpd.conf 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_alias_module modules/mod_authn_alias.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.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 authnz_ldap_module modules/mod_authnz_ldap.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_owner_module modules/mod_authz_owner.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule cache_module modules/mod_cache.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule charset_lite_module modules/mod_charset_lite.so LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_lock_module modules/mod_dav_lock.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule deflate_module modules/mod_deflate.so LoadModule dir_module modules/mod_dir.so #LoadModule disk_cache_module modules/mod_disk_cache.so #LoadModule dumpio_module modules/mod_dumpio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule filter_module modules/mod_filter.so #LoadModule headers_module modules/mod_headers.so #LoadModule ident_module modules/mod_ident.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 ldap_module modules/mod_ldap.so #LoadModule logio_module modules/mod_logio.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_forensic_module modules/mod_log_forensic.so #LoadModule mem_cache_module modules/mod_mem_cache.so LoadModule mime_module modules/mod_mime.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule negotiation_module modules/mod_negotiation.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_ftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule speling_module modules/mod_speling.so #LoadModule ssl_module modules/mod_ssl.so #LoadModule status_module modules/mod_status.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule unique_id_module modules/mod_unique_id.so   //mod_security 共同打开(下边配置中已经打开) #LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule version_module modules/mod_version.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #SVN Module conf LoadModule dav_svn_module "D:/Serv/Subversion/bin/mod_dav_svn.so" LoadModule authz_svn_module "D:/Serv/Subversion/bin/mod_authz_svn.so" #PHP Module conf LoadModule php5_module "D:/Serv/Apache/PHP/php5apache2_2.dll" PHPIniDir "D:/Serv/Apache/PHP/" #mod_security conf 2.5.12 LoadModule security2_module modules/mod_security2/mod_security2.so LoadModule unique_id_module modules/mod_unique_id.so SecRuleEngine On SecDefaultAction log,auditlog,deny,status:403,phase:2,t:lowercase,t:replaceNulls,t:compressWhitespace SecAuditEngine RelevantOnly SecAuditLogType Serial SecAuditLog logs/mod_security2.log #jk Module conf LoadModule jk_module modules/mod_jk.so Where to find workers.properties JkWorkersFile conf/worker.properties JkMountFile conf/uriworkermap.properties Where to put jk logs JkLogFile logs/mod_jk.log Set the jk log level [debug/error/info] JkLogLevel info Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" <IfModule !mpm_netware_module> <IfModule !mpm_winnt_module> ServerName localhost DocumentRoot "D:/Serv/wwwroot/" <Directory "D:/Serv/wwwroot/cache/status">     Order allow,deny     Deny from all     #allow from 127.0.0.1 </Directory> <Location /svn>         DAV svn         SVNPath "D:/Serv/svnroot/" </Location> 后面部分无关紧要的就不贴了。 worker.properties的配置 #--- see following for detail    "http://tomcat.apache.org/connectors-doc/"   "http://tomcat.apache.org/connectors-doc/reference/workers.html"   #========server列表======== worker.list=controller,status #========controller,负载均衡控制器========   load-balance worker, can be "lb, status" worker.controller.type=lb worker.controller.balance_workers=tomcat1,tomcat2 如何选择最优的worker, B[usyness]: 选最不忙的, R[equest]: 缺省 worker.controller.method=B #ticky_session   sticky_session_force             含义     true             false            SESSION会复制,有粘性     true             true             SESSION不复制,有粘性     false            false            SESSION会复制,无粘性     false            true             SESSION会复制,无粘性 注意 worker.controller.sticky_session=1,等同于worker.controller.sticky_session=true.此处指定集群是否需要会话复制, #如果设为true,则表明为会话粘性,不进行会话复制,当某用户的请求第一次分发到哪台Tomcat后,后继的请求会一直分发到此 #Tomcat服务器上处理;如果设为false,则表明需求会话复制。这就是说,如果你要想进行均衡负载,并在192.168.1.5和192.168.1.3 #两台机器的Tomcat实例上实现集群全局session复制,此处值要设置成false。 #sticky_session 1: True, otherwise False, 相同session id一直访问同一服务器    #sticky_session_force session id出错状态不返回500(Server Error), 由另一worker接手    worker.controller.sticky_session=0 worker.controller.sticky_session_force=0 #worker.status.type=status #========tomcat1========    worker.tomcat1.port=8009 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=1 worker.tomcat1.socket_connect_timeout=3000 #========tomcat2======== #worker.tomcat2.port=8009 #worker.tomcat2.host=localhost #worker.tomcat2.type=ajp13 #worker.tomcat2.lbfactor=1 #worker.tomcat2.socket_connect_timeout=3000 worker.connection_pool_size=10 #默认值(connection_pool_size +1)/ 2 worker.connection_pool_minsize=5 worker.socket_timeout=1 worker.socket_connect_timeout=3000 uriworkermap.properties配置,设置转发规则 /.jsp=controller /.do=controller /blog/=controller /bbs/=controller /site/=controller  !/.html=controller  !/.gif=controller  !/.jpg=controller  !/*.png=controller  extra/httpd-mpm.conf 模块   上边一样的就不贴了,主要是下边的配置,因为我用了mod_security模块,所以要做一些配置,这里不做解释了,写的很详细,我比较喜欢在配置文件里把容易忘记的地方写上文档。毕竟这东西配完了就不再动了,很容易忘记 WinNT MPM ThreadsPerChild: constant number of worker threads in the server process MaxRequestsPerChild: maximum  number of requests a server process serves #注意:ThreadLimit指令应当放在ThreadsPerChild之前,否则ThreadsPerChild指令生效后ThreadLimit会失效,而导致不必要的错误 ThreadLimit必须大于等于ThreadsPerChild #对于mpm_winnt,ThreadLimit的默认值是1920;对于其他MPM这个值是64 #ThreadLimit 这个指令设置了每个子进程可配置的线程数ThreadsPerChild上限。任何在重启期间对这个指令的改变都将被忽略,但对ThreadsPerChild的修改却会生效。 #ThreadLimit 使用这个指令时要特别当心。如果将ThreadLimit设置成一个高出ThreadsPerChild实际需要很多的值,将会有过多的共享内存被分配。 #如果将ThreadLimit和ThreadsPerChild设置成超过系统的处理能力,Apache可能无法启动,或者系统将变得不稳定。该指令的值应当和ThreadsPerChild大致保持一致 #ThreadsPerChild 每个子进程建立的常驻的执行线程数。默认值是25。子进程在启动时建立这些线程后就不再建立新的线程了。 <IfModule mpm_winnt_module>     ThreadLimit            2000     ThreadsPerChild        2000     MaxRequestsPerChild    2000 </IfModule> ######当然由于日常使用windows的原因,因此apache的配置并不一定适合linux 这里是NT架构使用了线程,而linux一般都是使用进程。 以前研究过apache的文档,但老是看过以后就忘记了,用的时候还得继续看,比较恶心。######嘿, 因为 Nginx 就是 http 协议的反向代理, 所以不需要像 apache 那样还得来个 JK 如果是我那,就直接在 Nginx 上分辨, 是 PHP 就给 Apache, 是 jsp 就直接 tomcat 连 apache 的 JK 都省了。 但Session 粘贴问题的话,Nginx 的 第三方 session 功能好像暂时还是在测试阶段...除非只用 cookies 所以应用还得斟酌了.######受教了

kun坤 2020-06-04 11:06:34 0 浏览量 回答数 0

回答

把配置贴全 <aclass="referer"target="_blank">@皮总 <preclass="brush:java;toolbar:true;auto-links:false;">##ThisisthemainApacheHTTPserverconfigurationfile.Itcontainsthe#configurationdirectivesthatgivetheserveritsinstructions.#See<URL:http://httpd.apache.org/docs/2.4/>fordetailedinformation.#Inparticular,see#<URL:http://httpd.apache.org/docs/2.4/mod/directives.html>#foradiscussionofeachconfigurationdirective.##DoNOTsimplyreadtheinstructionsinherewithoutunderstanding#whattheydo.They'rehereonlyashintsorreminders.Ifyouareunsure#consulttheonlinedocs.Youhavebeenwarned.##Configurationandlogfilenames:Ifthefilenamesyouspecifyformany#oftheserver'scontrolfilesbeginwith"/"(or"drive:/"forWin32),the#serverwillusethatexplicitpath.Ifthefilenamesdo notbegin#with"/",thevalueofServerRootisprepended--so"logs/access_log"#withServerRootsetto"/usr/local/apache2"willbeinterpretedbythe#serveras"/usr/local/apache2/logs/access_log",whereas"/logs/access_log"#willbeinterpretedas'/logs/access_log'.##ServerRoot:Thetopofthedirectorytreeunderwhichtheserver's#configuration,error,andlogfilesarekept.##Donotaddaslashattheendofthedirectorypath.Ifyoupoint#ServerRootatanon-localdisk,besuretospecifyalocaldiskonthe#Mutexdirective,iffile-basedmutexesareused.Ifyouwishtosharethe#sameServerRootformultiplehttpddaemons,youwillneedtochangeat#leastPidFile.#ServerRoot"/site01/program/apache"##Mutex:Allowsyoutosetthemutexmechanismandmutexfiledirectory#forindividualmutexes,orchangetheglobaldefaults##Uncommentandchangethedirectoryifmutexesarefile-basedandthedefault#mutexfiledirectoryisnotonalocaldiskorisnotappropriateforsome#otherreason.##Mutexdefault:logs##Listen:AllowsyoutobindApachetospecificIPaddressesand/or#ports,insteadofthedefault.Seealsothe<VirtualHost>#directive.##ChangethistoListenonspecificIPaddressesasshownbelowto#preventApachefromglommingontoallboundIPaddresses.##Listen12.34.56.78:80Listen80##DynamicSharedObject(DSO)Support##TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou#havetoplacecorresponding LoadModule'linesatthislocationsothe#directivescontainedinitareactuallyavailable_before_theyareused.#Staticallycompiledmodules(thoselistedbyhttpd-l')donotneed#tobeloadedhere.##Example:#LoadModulefoo_modulemodules/mod_foo.so#LoadModuleauthn_file_modulemodules/mod_authn_file.so#LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.so#LoadModuleauthn_anon_modulemodules/mod_authn_anon.so#LoadModuleauthn_dbd_modulemodules/mod_authn_dbd.so#LoadModuleauthn_socache_modulemodules/mod_authn_socache.soLoadModuleauthn_core_modulemodules/mod_authn_core.soLoadModuleauthz_host_modulemodules/mod_authz_host.soLoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.soLoadModuleauthz_user_modulemodules/mod_authz_user.so#LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.so#LoadModuleauthz_owner_modulemodules/mod_authz_owner.so#LoadModuleauthz_dbd_modulemodules/mod_authz_dbd.soLoadModuleauthz_core_modulemodules/mod_authz_core.soLoadModuleaccess_compat_modulemodules/mod_access_compat.soLoadModuleauth_basic_modulemodules/mod_auth_basic.so#LoadModuleauth_form_modulemodules/mod_auth_form.so#LoadModuleauth_digest_modulemodules/mod_auth_digest.so#LoadModuleallowmethods_modulemodules/mod_allowmethods.so#LoadModulefile_cache_modulemodules/mod_file_cache.so#LoadModulecache_modulemodules/mod_cache.so#LoadModulecache_disk_modulemodules/mod_cache_disk.so#LoadModulesocache_shmcb_modulemodules/mod_socache_shmcb.so#LoadModulesocache_dbm_modulemodules/mod_socache_dbm.so#LoadModulesocache_memcache_modulemodules/mod_socache_memcache.so#LoadModuledbd_modulemodules/mod_dbd.so#LoadModuledumpio_modulemodules/mod_dumpio.so#LoadModulebuffer_modulemodules/mod_buffer.so#LoadModuleratelimit_modulemodules/mod_ratelimit.soLoadModulereqtimeout_modulemodules/mod_reqtimeout.so#LoadModuleext_filter_modulemodules/mod_ext_filter.so#LoadModulerequest_modulemodules/mod_request.soLoadModuleinclude_modulemodules/mod_include.soLoadModulefilter_modulemodules/mod_filter.so#LoadModulesubstitute_modulemodules/mod_substitute.so#LoadModulesed_modulemodules/mod_sed.so#LoadModuledeflate_modulemodules/mod_deflate.soLoadModulemime_modulemodules/mod_mime.soLoadModulelog_config_modulemodules/mod_log_config.so#LoadModulelog_debug_modulemodules/mod_log_debug.so#LoadModulelogio_modulemodules/mod_logio.soLoadModuleenv_modulemodules/mod_env.so#LoadModuleexpires_modulemodules/mod_expires.soLoadModuleheaders_modulemodules/mod_headers.so#LoadModuleunique_id_modulemodules/mod_unique_id.soLoadModulesetenvif_modulemodules/mod_setenvif.soLoadModuleversion_modulemodules/mod_version.so#LoadModuleremoteip_modulemodules/mod_remoteip.so#LoadModuleproxy_modulemodules/mod_proxy.so#LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so#LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so#LoadModuleproxy_http_modulemodules/mod_proxy_http.so#LoadModuleproxy_fcgi_modulemodules/mod_proxy_fcgi.so#LoadModuleproxy_scgi_modulemodules/mod_proxy_scgi.so#LoadModuleproxy_ajp_modulemodules/mod_proxy_ajp.so#LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so#LoadModuleproxy_express_modulemodules/mod_proxy_express.so#LoadModulesession_modulemodules/mod_session.so#LoadModulesession_cookie_modulemodules/mod_session_cookie.so#LoadModulesession_dbd_modulemodules/mod_session_dbd.so#LoadModuleslotmem_shm_modulemodules/mod_slotmem_shm.so#LoadModulessl_modulemodules/mod_ssl.so#LoadModulelbmethod_byrequests_modulemodules/mod_lbmethod_byrequests.so#LoadModulelbmethod_bytraffic_modulemodules/mod_lbmethod_bytraffic.so#LoadModulelbmethod_bybusyness_modulemodules/mod_lbmethod_bybusyness.so#LoadModulelbmethod_heartbeat_modulemodules/mod_lbmethod_heartbeat.soLoadModuleunixd_modulemodules/mod_unixd.so#LoadModuledav_modulemodules/mod_dav.soLoadModulestatus_modulemodules/mod_status.soLoadModuleautoindex_modulemodules/mod_autoindex.so#LoadModuleinfo_modulemodules/mod_info.so#LoadModulecgid_modulemodules/mod_cgid.so#LoadModuledav_fs_modulemodules/mod_dav_fs.so#LoadModulevhost_alias_modulemodules/mod_vhost_alias.so#LoadModulenegotiation_modulemodules/mod_negotiation.soLoadModuledir_modulemodules/mod_dir.so#LoadModuleactions_modulemodules/mod_actions.so#LoadModulespeling_modulemodules/mod_speling.so#LoadModuleuserdir_modulemodules/mod_userdir.soLoadModulealias_modulemodules/mod_alias.soLoadModulerewrite_modulemodules/mod_rewrite.so<IfModuleunixd_module>##Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun#httpdasrootinitiallyanditwillswitch.##User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.#Itisusuallygoodpracticetocreateadedicateduserandgroupfor#runninghttpd,aswithmostsystemservices.#UserdaemonGroupdaemon</IfModule>#'Main'serverconfiguration##Thedirectivesinthissectionsetupthevaluesusedbythe'main'#server,whichrespondstoanyrequeststhataren'thandledbya#<VirtualHost>definition.Thesevaluesalsoprovidedefaultsfor#any<VirtualHost>containersyoumaydefinelaterinthefile.##Allofthesedirectivesmayappearinside<VirtualHost>containers,#inwhichcasethesedefaultsettingswillbeoverriddenforthe#virtualhostbeingdefined.###ServerAdmin:Youraddress,whereproblemswiththeservershouldbe#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such#aserrordocuments.e.g.admin@your-domain.com#ServerAdminyou@example.com##ServerNamegivesthenameandportthattheserverusestoidentifyitself.#Thiscanoftenbedeterminedautomatically,butwerecommendyouspecify#itexplicitlytopreventproblemsduringstartup.##Ifyourhostdoesn'thavearegisteredDNSname,enteritsIPaddresshere.##ServerNamewww.example.com:80##Denyaccesstotheentiretyofyourserver'sfilesystem.Youmust#explicitlypermitaccesstowebcontentdirectoriesinother#<Directory>blocksbelow.#<Directory/>OptionsIndexesFollowSymLinksIncludesAllowOverrideNoneOrderallow,denyAllowfromallSatisfyall</Directory>##Notethatfromthispointforwardyoumustspecificallyallow#particularfeaturestobeenabled-soifsomething'snotworkingas#youmightexpect,makesurethatyouhavespecificallyenabledit#below.###DocumentRoot:Thedirectoryoutofwhichyouwillserveyour#documents.Bydefault,allrequestsaretakenfromthisdirectory,but#symboliclinksandaliasesmaybeusedtopointtootherlocations.#DocumentRoot"/site01/program/apache/htdocs"<Directory"/site01/program/apache/htdocs">##PossiblevaluesfortheOptionsdirectiveare"None","All",#oranycombinationof:#IndexesIncludesFollowSymLinksSymLinksifOwnerMatchExecCGIMultiViews##Notethat"MultiViews"mustbenamed explicitly---"OptionsAll"#doesn'tgiveittoyou.##TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee#http://httpd.apache.org/docs/2.4/mod/core.html#options#formoreinformation.#OptionsIndexesFollowSymLinks##AllowOverridecontrolswhatdirectivesmaybeplacedin.htaccessfiles.#Itcanbe"All","None",oranycombinationofthekeywords:#AllowOverrideFileInfoAuthConfigLimit#AllowOverrideNone##Controlswhocangetstufffromthisserver.#Requireallgranted</Directory>##DirectoryIndex:setsthefilethatApachewillserveifadirectory#isrequested.#<IfModuledir_module>DirectoryIndexindex.htmlindex.jsp</IfModule>##Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing#viewedbyWebclients.#<Files".ht*">Requirealldenied</Files>##ErrorLog:Thelocationoftheerrorlogfile.#IfyoudonotspecifyanErrorLogdirectivewithina<VirtualHost>#container,errormessagesrelatingtothatvirtualhostwillbe#loggedhere.Ifyou dodefineanerrorlogfilefora<VirtualHost>#container,thathost'serrorswillbeloggedthereandnothere.#ErrorLog"logs/error_log"##LogLevel:Controlthenumberofmessagesloggedtotheerror_log.#Possiblevaluesinclude:debug,info,notice,warn,error,crit,#alert,emerg.#LogLevelwarn<IfModulelog_config_module>##Thefollowingdirectivesdefinesomeformatnicknamesforusewith#aCustomLogdirective(seebelow).#LogFormat"%h%l%u%t"%r"%>s%b"%{Referer}i""%{User-Agent}i""combinedLogFormat"%h%l%u%t"%r"%>s%b"common<IfModulelogio_module>#Youneedtoenablemod_logio.ctouse%Iand%OLogFormat"%h%l%u%t"%r"%>s%b"%{Referer}i""%{User-Agent}i"%I%O"combinedio</IfModule>##Thelocationandformatoftheaccesslogfile(CommonLogfileFormat).#Ifyoudonotdefineanyaccesslogfileswithina<VirtualHost>#container,theywillbeloggedhere.Contrariwise,ifyou do#defineper-<VirtualHost>accesslogfiles,transactionswillbe#loggedthereinand notinthisfile.#CustomLog"logs/access_log"common##Ifyoupreferalogfilewithaccess,agent,andrefererinformation#(CombinedLogfileFormat)youcanusethefollowingdirective.##CustomLog"logs/access_log"combined</IfModule><IfModulealias_module>##Redirect:Allowsyoutotellclientsaboutdocumentsthatusedto#existinyourserver'snamespace,butdonotanymore.Theclient#willmakeanewrequestforthedocumentatitsnewlocation.#Example:#Redirectpermanent/foohttp://www.example.com/bar##Alias:Mapswebpathsintofilesystempathsandisusedto#accesscontentthatdoesnotliveundertheDocumentRoot.#Example:#Alias/webpath/full/filesystem/path##Ifyouincludeatrailing/on/webpaththentheserverwill#requireittobepresentintheURL.Youwillalsolikely#needtoprovidea<Directory>sectiontoallowaccessto#thefilesystempath.##ScriptAlias:Thiscontrolswhichdirectoriescontainserverscripts.#ScriptAliasesareessentiallythesameasAliases,exceptthat#documentsinthetargetdirectoryaretreatedasapplicationsand#runbytheserverwhenrequestedratherthanasdocumentssenttothe#client.Thesamerulesabouttrailing"/"applytoScriptAlias#directivesastoAlias.#ScriptAlias/cgi-bin/"/site01/program/apache/cgi-bin/"</IfModule><IfModulecgid_module>##ScriptSock:Onthreadedservers,designatethepathtotheUNIX#socketusedtocommunicatewiththeCGIdaemonofmod_cgid.##Scriptsockcgisock</IfModule>##"/site01/program/apache/cgi-bin"shouldbechangedtowhateveryourScriptAliased#CGIdirectoryexists,ifyouhavethatconfigured.#<Directory"/site01/program/apache/cgi-bin">AllowOverrideNoneOptionsNoneRequireallgranted</Directory><IfModulemime_module>##TypesConfigpointstothefilecontainingthelistofmappingsfrom#filenameextensiontoMIME-type.#TypesConfigconf/mime.types##AddTypeallowsyoutoaddtooroverridetheMIMEconfiguration#filespecifiedinTypesConfigforspecificfiletypes.##AddTypeapplication/x-gzip.tgz##AddEncodingallowsyoutohavecertainbrowsersuncompress#informationonthefly.Note:Notallbrowserssupportthis.##AddEncodingx-compress.Z#AddEncodingx-gzip.gz.tgz##IftheAddEncodingdirectivesabovearecommented-out,thenyou#probablyshoulddefinethoseextensionstoindicatemediatypes:#AddTypeapplication/x-compress.ZAddTypeapplication/x-gzip.gz.tgz##AddHandlerallowsyoutomapcertainfileextensionsto"handlers":#actionsunrelatedtofiletype.Thesecanbeeitherbuiltintotheserver#oraddedwiththeActiondirective(seebelow)##TouseCGIscriptsoutsideofScriptAliaseddirectories:#(Youwillalsoneedtoadd"ExecCGI"tothe"Options"directive.)##AddHandlercgi-script.cgi#Fortypemaps(negotiatedresources):#AddHandlertype-mapvar##Filtersallowyoutoprocesscontentbeforeitissenttotheclient.##Toparse.shtmlfilesforserver-sideincludes(SSI):#(Youwillalsoneedtoadd"Includes"tothe"Options"directive.)#AddTypetext/html.htm.html.shtmAddOutputFilterINCLUDES.htm.html.shtm</IfModule>##Themod_mime_magicmoduleallowstheservertousevarioushintsfromthe#contentsofthefileitselftodetermineitstype.TheMIMEMagicFile#directivetellsthemodulewherethehintdefinitionsarelocated.##MIMEMagicFileconf/magic##Customizableerrorresponsescomeinthreeflavors:#1)plaintext2)localredirects3)externalredirects##Someexamples:#ErrorDocument500"Theservermadeabooboo."#ErrorDocument404/missing.html#ErrorDocument404"/cgi-bin/missing_handler.pl"#ErrorDocument402http://www.example.com/subscription_info.html###MaxRanges:MaximumnumberofRangesinarequestbefore#returningtheentireresource,oroneofthespecial#values'default','none'or'unlimited'.#Defaultsettingistoaccept200Ranges.#MaxRangesunlimited##EnableMMAPandEnableSendfile:Onsystemsthatsupportit,#memory-mappingorthesendfilesyscallmaybeusedtodeliver#files.Thisusuallyimprovesserverperformance,butmust#beturnedoffwhenservingfromnetworked-mounted#filesystemsorifsupportforthesefunctionsisotherwise#brokenonyoursystem.#Defaults:EnableMMAPOn,EnableSendfileOff##EnableMMAPoff#EnableSendfileon#Supplementalconfiguration##Theconfigurationfilesintheconf/extra/directorycanbe#includedtoaddextrafeaturesortomodifythedefaultconfigurationof#theserver,oryoumaysimplycopytheircontentshereandchangeas#necessary.#Server-poolmanagement(MPMspecific)#Includeconf/extra/httpd-mpm.conf#Multi-languageerrormessages#Includeconf/extra/httpd-multilang-errordoc.conf#Fancydirectorylistings#Includeconf/extra/httpd-autoindex.conf#Languagesettings#Includeconf/extra/httpd-languages.conf#Userhomedirectories#Includeconf/extra/httpd-userdir.conf#Real-timeinfoonrequestsandconfiguration#Includeconf/extra/httpd-info.conf#VirtualhostsIncludeconf/extra/httpd-vhosts.conf#LocalaccesstotheApacheHTTPServerManual#Includeconf/extra/httpd-manual.conf#Distributedauthoringandversioning(WebDAV)#Includeconf/extra/httpd-dav.conf#Variousdefaultsettings#Includeconf/extra/httpd-default.conf#Configuremod_proxy_htmltounderstandHTML4/XHTML1<IfModuleproxy_html_module>Includeconf/extra/proxy-html.conf</IfModule>#Secure(SSL/TLS)connections#Includeconf/extra/httpd-ssl.conf##Note:Thefollowingmustmustbepresenttosupport#startingwithoutSSLonplatformswithno/dev/randomequivalent#butastaticallycompiled-inmod_ssl.#<IfModulessl_module>SSLRandomSeedstartupbuiltinSSLRandomSeedconnectbuiltin</IfModule>##uncommentoutthebelowtodealwithuseragentsthatdeliberately#violateopenstandardsbymisusingDNT(DNT mustbeaspecific#end-userchoice)##<IfModulesetenvif_module>#BrowserMatch"MSIE10.0;"bad_DNT#</IfModule>#<IfModuleheaders_module>#RequestHeaderunsetDNTenv=bad_DNT#</IfModule>includeconf/mod_jk.conf 你apache2.4下面的那个重写咋写的啊http://www.oschina.net/question/77331_2143982--帮忙看看,啥地方没写好啊,我也是在原来IIS里面,可以使用,可是换了服务器就不行了回复<aclass='referer'target='_blank'>@皮总:谢谢皮总,搞定了,我正则在windows下好用,linux不好用,换了个方式就好了还不够全啊,你的Rewrite相关的没有出来

爱吃鱼的程序员 2020-06-22 19:46:06 0 浏览量 回答数 0

阿里云高校特惠,助力学生创业梦!0元体验,快速入门云计算!

学生动手场景应用,快速了解并掌握云服务器的各种新奇玩法!

问题

apache报错therequestedoperationhasfailed

失望 2019-12-01 21:00:00 14097 浏览量 回答数 2

回答

回1楼梦丫头的帖子 apache  弄了一天了  没弄明白,各种问题....................才想换 不知道那个好! ------------------------- 回3楼梦丫头的帖子 配置好后,访问很慢,很慢,导致打不开,不知道什么问题, 以下是配置文件 # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. # In particular, see # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do.  They're here only as hints or reminders.  If you are unsure # consult the online docs. You have been warned.   # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path.  If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). # If a drive letter is omitted, the drive on which httpd.exe is located # will be used by default.  It is recommended that you always supply # an explicit drive letter in absolute paths to avoid confusion. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path.  If you point # ServerRoot at a non-local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # Define SRVROOT "/Apache24" ServerRoot "D:/HJ/Apache24" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # #LoadModule access_compat_module modules/mod_access_compat.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule allowmethods_module modules/mod_allowmethods.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 auth_form_module modules/mod_auth_form.so #LoadModule authn_anon_module modules/mod_authn_anon.so LoadModule authn_core_module modules/mod_authn_core.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_socache_module modules/mod_authn_socache.so #LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so #LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule charset_lite_module modules/mod_charset_lite.so #LoadModule data_module modules/mod_data.so #LoadModule dav_module modules/mod_dav.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_lock_module modules/mod_dav_lock.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule deflate_module modules/mod_deflate.so LoadModule dir_module modules/mod_dir.so #LoadModule dumpio_module modules/mod_dumpio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule filter_module modules/mod_filter.so #LoadModule headers_module modules/mod_headers.so #LoadModule heartbeat_module modules/mod_heartbeat.so #LoadModule heartmonitor_module modules/mod_heartmonitor.so #LoadModule ident_module modules/mod_ident.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 lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so #LoadModule ldap_module modules/mod_ldap.so #LoadModule logio_module modules/mod_logio.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule log_forensic_module modules/mod_log_forensic.so #LoadModule lua_module modules/mod_lua.so #LoadModule macro_module modules/mod_macro.so LoadModule mime_module modules/mod_mime.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule negotiation_module modules/mod_negotiation.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_express_module modules/mod_proxy_express.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_html_module modules/mod_proxy_html.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule ratelimit_module modules/mod_ratelimit.so #LoadModule reflector_module modules/mod_reflector.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule request_module modules/mod_request.so #LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule rewrite_module modules/mod_rewrite.so #LoadModule sed_module modules/mod_sed.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_crypto_module modules/mod_session_crypto.so #LoadModule session_dbd_module modules/mod_session_dbd.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule speling_module modules/mod_speling.so LoadModule ssl_module modules/mod_ssl.so LoadModule status_module modules/mod_status.so #LoadModule substitute_module modules/mod_substitute.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 version_module modules/mod_version.so LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule xml2enc_module modules/mod_xml2enc.so <IfModule unixd_module> # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch.   # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon </IfModule> # 'Main' server configuration # # The directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a # <VirtualHost> definition.  These values also provide defaults for # any <VirtualHost> containers you may define later in the file. # # All of these directives may appear inside <VirtualHost> containers, # in which case these default settings will be overridden for the # virtual host being defined. # # # ServerAdmin: Your address, where problems with the server should be # e-mailed.  This address appears on some server-generated pages, such # as error documents.  e.g. admin@your-domain.com # ServerAdmin admin@example.com # # 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 your host doesn't have a registered DNS name, enter its IP address here. # ServerName localhost:80 # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride none     Require all denied </Directory> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "d:/wed" <Directory "d:/wed">     #     # Possible values for the Options directive are "None", "All",     # or any combination of:     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews     #     # Note that "MultiViews" must be named *explicitly* --- "Options All"     # doesn't give it to you.     #     # The Options directive is both complicated and important.  Please see     # http://httpd.apache.org/docs/2.4/mod/core.html#options     # for more information.     #     Options Indexes FollowSymLinks     #     # AllowOverride controls what directives may be placed in .htaccess files.     # It can be "All", "None", or any combination of the keywords:     #   Options FileInfo AuthConfig Limit     #     AllowOverride FileInfo     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.php index.htm index.html </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here.  If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog "logs/error.log" # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn <IfModule log_config_module>     #     # The following directives define some format nicknames for use with     # a CustomLog directive (see below).     #     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>       # You need to enable mod_logio.c to use %I and %O       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio     </IfModule>     #     # The location and format of the access logfile (Common Logfile Format).     # If you do not define any access logfiles within a <VirtualHost>     # container, they will be logged here.  Contrariwise, if you *do*     # define per-<VirtualHost> access logfiles, transactions will be     # logged therein and *not* in this file.     #     CustomLog "logs/access.log" common     #     # If you prefer a logfile with access, agent, and referer information     # (Combined Logfile Format) you can use the following directive.     #     #CustomLog "logs/access.log" combined </IfModule> <IfModule alias_module>     #     # Redirect: Allows you to tell clients about documents that used to     # exist in your server's namespace, but do not anymore. The client     # will make a new request for the document at its new location.     # Example:     # Redirect permanent /foo http://www.example.com/bar     #     # Alias: Maps web paths into filesystem paths and is used to     # access content that does not live under the DocumentRoot.     # Example:     # Alias /webpath /full/filesystem/path     #     # If you include a trailing / on /webpath then the server will     # require it to be present in the URL.  You will also likely     # need to provide a <Directory> section to allow access to     # the filesystem path.     #     # ScriptAlias: This controls which directories contain server scripts.     # ScriptAliases are essentially the same as Aliases, except that     # documents in the target directory are treated as applications and     # run by the server when requested rather than as documents sent to the     # client.  The same rules about trailing "/" apply to ScriptAlias     # directives as to Alias.     #     ScriptAlias /cgi-bin/ "d:/Apache24/cgi-bin/" </IfModule> <IfModule cgid_module>     #     # ScriptSock: On threaded servers, designate the path to the UNIX     # socket used to communicate with the CGI daemon of mod_cgid.     #     #Scriptsock logs/cgisock </IfModule> # # "${SRVROOT}/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "d:/HJ/Apache24/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <IfModule mime_module>     #     # TypesConfig points to the file containing the list of mappings from     # filename extension to MIME-type.     #     TypesConfig conf/mime.types     #     # AddType allows you to add to or override the MIME configuration     # file specified in TypesConfig for specific file types.     #     #AddType application/x-gzip .tgz     #     # AddEncoding allows you to have certain browsers uncompress     # information on the fly. Note: Not all browsers support this.     #     #AddEncoding x-compress .Z     #AddEncoding x-gzip .gz .tgz     #     # If the AddEncoding directives above are commented-out, then you     # probably should define those extensions to indicate media types:     #     AddType application/x-compress .Z     AddType application/x-gzip .gz .tgz     #     # AddHandler allows you to map certain file extensions to "handlers":     # actions unrelated to filetype. These can be either built into the server     # or added with the Action directive (see below)     #     # To use CGI scripts outside of ScriptAliased directories:     # (You will also need to add "ExecCGI" to the "Options" directive.)     #     #AddHandler cgi-script .cgi .pl     # For type maps (negotiated resources):     #AddHandler type-map var     #     # Filters allow you to process content before it is sent to the client.     #     # To parse .shtml files for server-side includes (SSI):     # (You will also need to add "Includes" to the "Options" directive.)     #     #AddType text/html .shtml     #AddOutputFilter INCLUDES .shtml </IfModule> # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type.  The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 http://www.example.com/subscription_info.html # # # MaxRanges: Maximum number of Ranges in a request before # returning the entire resource, or one of the special # values 'default', 'none' or 'unlimited'. # Default setting is to accept 200 Ranges. #MaxRanges unlimited # # EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files.  This usually improves server performance, but must # be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on #AcceptFilter http none #AcceptFilter https none # Supplemental configuration # # The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary. # Server-pool management (MPM specific) #Include conf/extra/httpd-mpm.conf # Multi-language error messages #Include conf/extra/httpd-multilang-errordoc.conf # Fancy directory listings Include conf/extra/httpd-autoindex.conf # Language settings #Include conf/extra/httpd-languages.conf # User home directories #Include conf/extra/httpd-userdir.conf # Real-time info on requests and configuration Include conf/extra/httpd-info.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav.conf # Various default settings #Include conf/extra/httpd-default.conf # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/httpd-proxy-html.conf </IfModule> # Secure (SSL/TLS) connections # Note: The following must must be present to support #       starting without SSL on platforms with no /dev/random equivalent #       but a statically compiled-in mod_ssl. # <IfModule ssl_module> #Include conf/extra/httpd-ssl.conf Include conf/extra/httpd-ahssl.conf SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> LoadModule php5_module "d:/HJ/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir "d:/HJ/php" ------------------------- 回5楼梦丫头的帖子 这个是apache的配置文件 httpd.conf

失望 2019-12-02 03:07:31 0 浏览量 回答数 0

回答

首先要提出来的是安全问题。本节讨论的思想如果没有一些额外的安全和认知机制的话会很糟糕。 也就是说,我们的主要目的是深入分析Python的import语句机制。 如果你理解了本节内部原理,你就能够为其他任何目的而自定义import。 有了这些,让我们继续向前走。 本节核心是设计导入语句的扩展功能。有很多种方法可以做这个, 不过为了演示的方便,我们开始先构造下面这个Python代码结构: testcode/ spam.py fib.py grok/ __init__.py blah.py 这些文件的内容并不重要,不过我们在每个文件中放入了少量的简单语句和函数, 这样你可以测试它们并查看当它们被导入时的输出。例如: # spam.py print("I'm spam") def hello(name): print('Hello %s' % name) # fib.py print("I'm fib") def fib(n): if n < 2: return 1 else: return fib(n-1) + fib(n-2) # grok/__init__.py print("I'm grok.__init__") # grok/blah.py print("I'm grok.blah") 这里的目的是允许这些文件作为模块被远程访问。 也许最简单的方式就是将它们发布到一个web服务器上面。在testcode目录中像下面这样运行Python: bash % cd testcode bash % python3 -m http.server 15000 Serving HTTP on 0.0.0.0 port 15000 ... 服务器运行起来后再启动一个单独的Python解释器。 确保你可以使用 urllib 访问到远程文件。例如: >>> from urllib.request import urlopen >>> u = urlopen('http://localhost:15000/fib.py') >>> data = u.read().decode('utf-8') >>> print(data) # fib.py print("I'm fib") def fib(n): if n < 2: return 1 else: return fib(n-1) + fib(n-2) >>> 从这个服务器加载源代码是接下来本节的基础。 为了替代手动的通过 urlopen() 来收集源文件, 我们通过自定义import语句来在后台自动帮我们做到。 加载远程模块的第一种方法是创建一个显式的加载函数来完成它。例如: import imp import urllib.request import sys def load_module(url): u = urllib.request.urlopen(url) source = u.read().decode('utf-8') mod = sys.modules.setdefault(url, imp.new_module(url)) code = compile(source, url, 'exec') mod.__file__ = url mod.__package__ = '' exec(code, mod.__dict__) return mod 这个函数会下载源代码,并使用 compile() 将其编译到一个代码对象中, 然后在一个新创建的模块对象的字典中来执行它。下面是使用这个函数的方式: >>> fib = load_module('http://localhost:15000/fib.py') I'm fib >>> fib.fib(10) 89 >>> spam = load_module('http://localhost:15000/spam.py') I'm spam >>> spam.hello('Guido') Hello Guido >>> fib <module 'http://localhost:15000/fib.py' from 'http://localhost:15000/fib.py'> >>> spam <module 'http://localhost:15000/spam.py' from 'http://localhost:15000/spam.py'> >>> 正如你所见,对于简单的模块这个是行得通的。 不过它并没有嵌入到通常的import语句中,如果要支持更高级的结构比如包就需要更多的工作了。 一个更酷的做法是创建一个自定义导入器。第一种方法是创建一个元路径导入器。如下: # urlimport.py import sys import importlib.abc import imp from urllib.request import urlopen from urllib.error import HTTPError, URLError from html.parser import HTMLParser # Debugging import logging log = logging.getLogger(__name__) # Get links from a given URL def _get_links(url): class LinkParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a': attrs = dict(attrs) links.add(attrs.get('href').rstrip('/')) links = set() try: log.debug('Getting links from %s' % url) u = urlopen(url) parser = LinkParser() parser.feed(u.read().decode('utf-8')) except Exception as e: log.debug('Could not get links. %s', e) log.debug('links: %r', links) return links class UrlMetaFinder(importlib.abc.MetaPathFinder): def __init__(self, baseurl): self._baseurl = baseurl self._links = { } self._loaders = { baseurl : UrlModuleLoader(baseurl) } def find_module(self, fullname, path=None): log.debug('find_module: fullname=%r, path=%r', fullname, path) if path is None: baseurl = self._baseurl else: if not path[0].startswith(self._baseurl): return None baseurl = path[0] parts = fullname.split('.') basename = parts[-1] log.debug('find_module: baseurl=%r, basename=%r', baseurl, basename) # Check link cache if basename not in self._links: self._links[baseurl] = _get_links(baseurl) # Check if it's a package if basename in self._links[baseurl]: log.debug('find_module: trying package %r', fullname) fullurl = self._baseurl + '/' + basename # Attempt to load the package (which accesses __init__.py) loader = UrlPackageLoader(fullurl) try: loader.load_module(fullname) self._links[fullurl] = _get_links(fullurl) self._loaders[fullurl] = UrlModuleLoader(fullurl) log.debug('find_module: package %r loaded', fullname) except ImportError as e: log.debug('find_module: package failed. %s', e) loader = None return loader # A normal module filename = basename + '.py' if filename in self._links[baseurl]: log.debug('find_module: module %r found', fullname) return self._loaders[baseurl] else: log.debug('find_module: module %r not found', fullname) return None def invalidate_caches(self): log.debug('invalidating link cache') self._links.clear() # Module Loader for a URL class UrlModuleLoader(importlib.abc.SourceLoader): def __init__(self, baseurl): self._baseurl = baseurl self._source_cache = {} def module_repr(self, module): return '<urlmodule %r from %r>' % (module.__name__, module.__file__) # Required method def load_module(self, fullname): code = self.get_code(fullname) mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) mod.__file__ = self.get_filename(fullname) mod.__loader__ = self mod.__package__ = fullname.rpartition('.')[0] exec(code, mod.__dict__) return mod # Optional extensions def get_code(self, fullname): src = self.get_source(fullname) return compile(src, self.get_filename(fullname), 'exec') def get_data(self, path): pass def get_filename(self, fullname): return self._baseurl + '/' + fullname.split('.')[-1] + '.py' def get_source(self, fullname): filename = self.get_filename(fullname) log.debug('loader: reading %r', filename) if filename in self._source_cache: log.debug('loader: cached %r', filename) return self._source_cache[filename] try: u = urlopen(filename) source = u.read().decode('utf-8') log.debug('loader: %r loaded', filename) self._source_cache[filename] = source return source except (HTTPError, URLError) as e: log.debug('loader: %r failed. %s', filename, e) raise ImportError("Can't load %s" % filename) def is_package(self, fullname): return False # Package loader for a URL class UrlPackageLoader(UrlModuleLoader): def load_module(self, fullname): mod = super().load_module(fullname) mod.__path__ = [ self._baseurl ] mod.__package__ = fullname def get_filename(self, fullname): return self._baseurl + '/' + '__init__.py' def is_package(self, fullname): return True # Utility functions for installing/uninstalling the loader _installed_meta_cache = { } def install_meta(address): if address not in _installed_meta_cache: finder = UrlMetaFinder(address) _installed_meta_cache[address] = finder sys.meta_path.append(finder) log.debug('%r installed on sys.meta_path', finder) def remove_meta(address): if address in _installed_meta_cache: finder = _installed_meta_cache.pop(address) sys.meta_path.remove(finder) log.debug('%r removed from sys.meta_path', finder) 下面是一个交互会话,演示了如何使用前面的代码: >>> # importing currently fails >>> import fib Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'fib' >>> # Load the importer and retry (it works) >>> import urlimport >>> urlimport.install_meta('http://localhost:15000') >>> import fib I'm fib >>> import spam I'm spam >>> import grok.blah I'm grok.__init__ I'm grok.blah >>> grok.blah.__file__ 'http://localhost:15000/grok/blah.py' >>> 这个特殊的方案会安装一个特别的查找器 UrlMetaFinder 实例, 作为 sys.meta_path 中最后的实体。 当模块被导入时,会依据 sys.meta_path 中的查找器定位模块。 在这个例子中,UrlMetaFinder 实例是最后一个查找器方案, 当模块在任何一个普通地方都找不到的时候就触发它。 作为常见的实现方案,UrlMetaFinder 类包装在一个用户指定的URL上。 在内部,查找器通过抓取指定URL的内容构建合法的链接集合。 导入的时候,模块名会跟已有的链接作对比。如果找到了一个匹配的, 一个单独的 UrlModuleLoader 类被用来从远程机器上加载源代码并创建最终的模块对象。 这里缓存链接的一个原因是避免不必要的HTTP请求重复导入。 自定义导入的第二种方法是编写一个钩子直接嵌入到 sys.path 变量中去, 识别某些目录命名模式。 在 urlimport.py 中添加如下的类和支持函数: # urlimport.py # ... include previous code above ... # Path finder class for a URL class UrlPathFinder(importlib.abc.PathEntryFinder): def __init__(self, baseurl): self._links = None self._loader = UrlModuleLoader(baseurl) self._baseurl = baseurl def find_loader(self, fullname): log.debug('find_loader: %r', fullname) parts = fullname.split('.') basename = parts[-1] # Check link cache if self._links is None: self._links = [] # See discussion self._links = _get_links(self._baseurl) # Check if it's a package if basename in self._links: log.debug('find_loader: trying package %r', fullname) fullurl = self._baseurl + '/' + basename # Attempt to load the package (which accesses __init__.py) loader = UrlPackageLoader(fullurl) try: loader.load_module(fullname) log.debug('find_loader: package %r loaded', fullname) except ImportError as e: log.debug('find_loader: %r is a namespace package', fullname) loader = None return (loader, [fullurl]) # A normal module filename = basename + '.py' if filename in self._links: log.debug('find_loader: module %r found', fullname) return (self._loader, []) else: log.debug('find_loader: module %r not found', fullname) return (None, []) def invalidate_caches(self): log.debug('invalidating link cache') self._links = None # Check path to see if it looks like a URL _url_path_cache = {} def handle_url(path): if path.startswith(('http://', 'https://')): log.debug('Handle path? %s. [Yes]', path) if path in _url_path_cache: finder = _url_path_cache[path] else: finder = UrlPathFinder(path) _url_path_cache[path] = finder return finder else: log.debug('Handle path? %s. [No]', path) def install_path_hook(): sys.path_hooks.append(handle_url) sys.path_importer_cache.clear() log.debug('Installing handle_url') def remove_path_hook(): sys.path_hooks.remove(handle_url) sys.path_importer_cache.clear() log.debug('Removing handle_url') 要使用这个路径查找器,你只需要在 sys.path 中加入URL链接。例如: >>> # Initial import fails >>> import fib Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'fib' >>> # Install the path hook >>> import urlimport >>> urlimport.install_path_hook() >>> # Imports still fail (not on path) >>> import fib Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'fib' >>> # Add an entry to sys.path and watch it work >>> import sys >>> sys.path.append('http://localhost:15000') >>> import fib I'm fib >>> import grok.blah I'm grok.__init__ I'm grok.blah >>> grok.blah.__file__ 'http://localhost:15000/grok/blah.py' >>> 关键点就是 handle_url() 函数,它被添加到了 sys.path_hooks 变量中。 当 sys.path 的实体被处理时,会调用 sys.path_hooks 中的函数。 如果任何一个函数返回了一个查找器对象,那么这个对象就被用来为 sys.path 实体加载模块。 远程模块加载跟其他的加载使用方法几乎是一样的。例如: >>> fib <urlmodule 'fib' from 'http://localhost:15000/fib.py'> >>> fib.__name__ 'fib' >>> fib.__file__ 'http://localhost:15000/fib.py' >>> import inspect >>> print(inspect.getsource(fib)) # fib.py print("I'm fib") def fib(n): if n < 2: return 1 else: return fib(n-1) + fib(n-2) >>>

哦哦喔 2020-04-17 17:11:05 0 浏览量 回答数 0

回答

回 1楼dongshan8的帖子 Apache我重装成2.4的版本  这个问题已经没有了    但是现在配置好以后用https访问却显示"此网站无法提供安全连接"  "使用了不受支持的协议" "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"        安全组配置了443端口     ------------------------- 回 3楼dongshan8的帖子 现在只能通过SSL2.0访问       但是配置里面协议我已经这 样子设置了"SSLProtocol all -SSLv2 -SSLv3"       怎么改都没效果      是一直使用的SSL2.0 ------------------------- 回 6楼dongshan8的帖子 openssl的版本是1.0.1u   我在服务器上wget了一下https的地址   结果显示 sslv3 alert handshake failure   用openssl s_client -connect 测试了一下地址     怎么最后说Verify return code: 20 (unable to get local issuer certificate) ------------------------- Re回 8楼dongshan8的帖子 # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # In particular, see # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do.  They're here only as hints or reminders.  If you are unsure # consult the online docs. You have been warned.   # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path.  If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path.  If you point # ServerRoot at a non-local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/usr/local/http-2.4.23" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_socache_module modules/mod_authn_socache.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_owner_module modules/mod_authz_owner.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_form_module modules/mod_auth_form.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule allowmethods_module modules/mod_allowmethods.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule macro_module modules/mod_macro.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule dumpio_module modules/mod_dumpio.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule ratelimit_module modules/mod_ratelimit.so LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule request_module modules/mod_request.so #LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule sed_module modules/mod_sed.so #LoadModule deflate_module modules/mod_deflate.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule ssl_module modules/mod_ssl.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule mpm_event_module modules/mod_mpm_event.so #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so <IfModule !mpm_prefork_module>     #LoadModule cgid_module modules/mod_cgid.so </IfModule> <IfModule mpm_prefork_module>     #LoadModule cgi_module modules/mod_cgi.so </IfModule> #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module        modules/libphp5.so <IfModule unixd_module> # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch.   # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon </IfModule> # 'Main' server configuration # # The directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a # <VirtualHost> definition.  These values also provide defaults for # any <VirtualHost> containers you may define later in the file. # # All of these directives may appear inside <VirtualHost> containers, # in which case these default settings will be overridden for the # virtual host being defined. # # # ServerAdmin: Your address, where problems with the server should be # e-mailed.  This address appears on some server-generated pages, such # as error documents.  e.g. admin@your-domain.com # ServerAdmin root@localhost # # 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 your host doesn't have a registered DNS name, enter its IP address here. # ServerName localhost # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride All     Require all denied </Directory> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # #DocumentRoot "/var/www/" <Directory "/var/www/">     #     # Possible values for the Options directive are "None", "All",     # or any combination of:     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews     #     # Note that "MultiViews" must be named *explicitly* --- "Options All"     # doesn't give it to you.     #     # The Options directive is both complicated and important.  Please see     # for more information.     #     Options Indexes FollowSymLinks     #     # AllowOverride controls what directives may be placed in .htaccess files.     # It can be "All", "None", or any combination of the keywords:     #   AllowOverride FileInfo AuthConfig Limit     #     AllowOverride All     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.html index.php </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here.  If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog "logs/error_log" # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn <IfModule log_config_module>     #     # The following directives define some format nicknames for use with     # a CustomLog directive (see below).     #     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>       # You need to enable mod_logio.c to use %I and %O       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio     </IfModule>     #     # The location and format of the access logfile (Common Logfile Format).     # If you do not define any access logfiles within a <VirtualHost>     # container, they will be logged here.  Contrariwise, if you *do*     # define per-<VirtualHost> access logfiles, transactions will be     # logged therein and *not* in this file.     #     CustomLog "logs/access_log" common     #     # If you prefer a logfile with access, agent, and referer information     # (Combined Logfile Format) you can use the following directive.     #     #CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module>     #     # Redirect: Allows you to tell clients about documents that used to     # exist in your server's namespace, but do not anymore. The client     # will make a new request for the document at its new location.     # Example:     # Redirect permanent /foo http://www.example.com/bar     #     # Alias: Maps web paths into filesystem paths and is used to     # access content that does not live under the DocumentRoot.     # Example:     # Alias /webpath /full/filesystem/path     #     # If you include a trailing / on /webpath then the server will     # require it to be present in the URL.  You will also likely     # need to provide a <Directory> section to allow access to     # the filesystem path.     #     # ScriptAlias: This controls which directories contain server scripts.     # ScriptAliases are essentially the same as Aliases, except that     # documents in the target directory are treated as applications and     # run by the server when requested rather than as documents sent to the     # client.  The same rules about trailing "/" apply to ScriptAlias     # directives as to Alias.     #     ScriptAlias /cgi-bin/ "/usr/local/http-2.4.23/cgi-bin/" </IfModule> <IfModule mod_php5.c>     AddType application/x-httpd-php .php     AddType application/x-httpd-php .php5     AddType application/x-httpd-php-source .phps     AddType application/x-httpd-php-source .php5s     DirectoryIndex index.php     DirectoryIndex index.php5     PHPIniDir "/usr/local/php/etc/" </IfModule> <IfModule cgid_module>     #     # ScriptSock: On threaded servers, designate the path to the UNIX     # socket used to communicate with the CGI daemon of mod_cgid.     #     #Scriptsock cgisock </IfModule> # # "/usr/local/http-2.4.23/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/usr/local/http-2.4.23/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <IfModule mime_module>     #     # TypesConfig points to the file containing the list of mappings from     # filename extension to MIME-type.     #     TypesConfig conf/mime.types     #     # AddType allows you to add to or override the MIME configuration     # file specified in TypesConfig for specific file types.     #     #AddType application/x-gzip .tgz     #     # AddEncoding allows you to have certain browsers uncompress     # information on the fly. Note: Not all browsers support this.     #     #AddEncoding x-compress .Z     #AddEncoding x-gzip .gz .tgz     #     # If the AddEncoding directives above are commented-out, then you     # probably should define those extensions to indicate media types:     #     AddType application/x-compress .Z     AddType application/x-gzip .gz .tgz     #     # AddHandler allows you to map certain file extensions to "handlers":     # actions unrelated to filetype. These can be either built into the server     # or added with the Action directive (see below)     #     # To use CGI scripts outside of ScriptAliased directories:     # (You will also need to add "ExecCGI" to the "Options" directive.)     #     #AddHandler cgi-script .cgi     # For type maps (negotiated resources):     #AddHandler type-map var     #     # Filters allow you to process content before it is sent to the client.     #     # To parse .shtml files for server-side includes (SSI):     # (You will also need to add "Includes" to the "Options" directive.)     #     #AddType text/html .shtml     #AddOutputFilter INCLUDES .shtml </IfModule> # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type.  The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" # # # MaxRanges: Maximum number of Ranges in a request before # returning the entire resource, or one of the special # values 'default', 'none' or 'unlimited'. # Default setting is to accept 200 Ranges. #MaxRanges unlimited # # EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files.  This usually improves server performance, but must # be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on # Supplemental configuration # # The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary. # Server-pool management (MPM specific) #Include conf/extra/httpd-mpm.conf # Multi-language error messages #Include conf/extra/httpd-multilang-errordoc.conf # Fancy directory listings #Include conf/extra/httpd-autoindex.conf # Language settings #Include conf/extra/httpd-languages.conf # User home directories #Include conf/extra/httpd-userdir.conf # Real-time info on requests and configuration #Include conf/extra/httpd-info.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav.conf # Various default settings #Include conf/extra/httpd-default.conf # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/proxy-html.conf </IfModule> # Secure (SSL/TLS) connections Include conf/extra/httpd-ssl.conf # # Note: The following must must be present to support #       starting without SSL on platforms with no /dev/random equivalent #       but a statically compiled-in mod_ssl. # <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> ------------------------- Re回 8楼dongshan8的帖子 # Virtual Hosts # # Required modules: mod_log_config # 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. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerAdmin www.qipaifan.com DocumentRoot " ServerName www.qipaifan.com <Directory /> AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin bbs.qipaifan.com DocumentRoot "/ ServerName bbs.qipaifan.com <Directory /> AllowOverride all Require all granted </Directory> </VirtualHost> ------------------------- Re回 8楼dongshan8的帖子 ssl配置文件发不上来      发图片吧        我没发现有什么异常啊...

淘乐网络 2019-12-02 00:26:29 0 浏览量 回答数 0

回答

回 1楼dongshan8的帖子 Apache我重装成2.4的版本  这个问题已经没有了    但是现在配置好以后用https访问却显示"此网站无法提供安全连接"  "使用了不受支持的协议" "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"        安全组配置了443端口     ------------------------- 回 3楼dongshan8的帖子 现在只能通过SSL2.0访问       但是配置里面协议我已经这 样子设置了"SSLProtocol all -SSLv2 -SSLv3"       怎么改都没效果      是一直使用的SSL2.0 ------------------------- 回 6楼dongshan8的帖子 openssl的版本是1.0.1u   我在服务器上wget了一下https的地址   结果显示 sslv3 alert handshake failure   用openssl s_client -connect 测试了一下地址     怎么最后说Verify return code: 20 (unable to get local issuer certificate) ------------------------- Re回 8楼dongshan8的帖子 # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # In particular, see # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do.  They're here only as hints or reminders.  If you are unsure # consult the online docs. You have been warned.   # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path.  If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path.  If you point # ServerRoot at a non-local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/usr/local/http-2.4.23" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_socache_module modules/mod_authn_socache.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_owner_module modules/mod_authz_owner.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_form_module modules/mod_auth_form.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule allowmethods_module modules/mod_allowmethods.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule macro_module modules/mod_macro.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule dumpio_module modules/mod_dumpio.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule ratelimit_module modules/mod_ratelimit.so LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule request_module modules/mod_request.so #LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule sed_module modules/mod_sed.so #LoadModule deflate_module modules/mod_deflate.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule ssl_module modules/mod_ssl.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule mpm_event_module modules/mod_mpm_event.so #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so <IfModule !mpm_prefork_module>     #LoadModule cgid_module modules/mod_cgid.so </IfModule> <IfModule mpm_prefork_module>     #LoadModule cgi_module modules/mod_cgi.so </IfModule> #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module        modules/libphp5.so <IfModule unixd_module> # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch.   # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon </IfModule> # 'Main' server configuration # # The directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a # <VirtualHost> definition.  These values also provide defaults for # any <VirtualHost> containers you may define later in the file. # # All of these directives may appear inside <VirtualHost> containers, # in which case these default settings will be overridden for the # virtual host being defined. # # # ServerAdmin: Your address, where problems with the server should be # e-mailed.  This address appears on some server-generated pages, such # as error documents.  e.g. admin@your-domain.com # ServerAdmin root@localhost # # 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 your host doesn't have a registered DNS name, enter its IP address here. # ServerName localhost # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride All     Require all denied </Directory> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # #DocumentRoot "/var/www/" <Directory "/var/www/">     #     # Possible values for the Options directive are "None", "All",     # or any combination of:     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews     #     # Note that "MultiViews" must be named *explicitly* --- "Options All"     # doesn't give it to you.     #     # The Options directive is both complicated and important.  Please see     # for more information.     #     Options Indexes FollowSymLinks     #     # AllowOverride controls what directives may be placed in .htaccess files.     # It can be "All", "None", or any combination of the keywords:     #   AllowOverride FileInfo AuthConfig Limit     #     AllowOverride All     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.html index.php </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here.  If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog "logs/error_log" # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn <IfModule log_config_module>     #     # The following directives define some format nicknames for use with     # a CustomLog directive (see below).     #     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>       # You need to enable mod_logio.c to use %I and %O       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio     </IfModule>     #     # The location and format of the access logfile (Common Logfile Format).     # If you do not define any access logfiles within a <VirtualHost>     # container, they will be logged here.  Contrariwise, if you *do*     # define per-<VirtualHost> access logfiles, transactions will be     # logged therein and *not* in this file.     #     CustomLog "logs/access_log" common     #     # If you prefer a logfile with access, agent, and referer information     # (Combined Logfile Format) you can use the following directive.     #     #CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module>     #     # Redirect: Allows you to tell clients about documents that used to     # exist in your server's namespace, but do not anymore. The client     # will make a new request for the document at its new location.     # Example:     # Redirect permanent /foo http://www.example.com/bar     #     # Alias: Maps web paths into filesystem paths and is used to     # access content that does not live under the DocumentRoot.     # Example:     # Alias /webpath /full/filesystem/path     #     # If you include a trailing / on /webpath then the server will     # require it to be present in the URL.  You will also likely     # need to provide a <Directory> section to allow access to     # the filesystem path.     #     # ScriptAlias: This controls which directories contain server scripts.     # ScriptAliases are essentially the same as Aliases, except that     # documents in the target directory are treated as applications and     # run by the server when requested rather than as documents sent to the     # client.  The same rules about trailing "/" apply to ScriptAlias     # directives as to Alias.     #     ScriptAlias /cgi-bin/ "/usr/local/http-2.4.23/cgi-bin/" </IfModule> <IfModule mod_php5.c>     AddType application/x-httpd-php .php     AddType application/x-httpd-php .php5     AddType application/x-httpd-php-source .phps     AddType application/x-httpd-php-source .php5s     DirectoryIndex index.php     DirectoryIndex index.php5     PHPIniDir "/usr/local/php/etc/" </IfModule> <IfModule cgid_module>     #     # ScriptSock: On threaded servers, designate the path to the UNIX     # socket used to communicate with the CGI daemon of mod_cgid.     #     #Scriptsock cgisock </IfModule> # # "/usr/local/http-2.4.23/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/usr/local/http-2.4.23/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <IfModule mime_module>     #     # TypesConfig points to the file containing the list of mappings from     # filename extension to MIME-type.     #     TypesConfig conf/mime.types     #     # AddType allows you to add to or override the MIME configuration     # file specified in TypesConfig for specific file types.     #     #AddType application/x-gzip .tgz     #     # AddEncoding allows you to have certain browsers uncompress     # information on the fly. Note: Not all browsers support this.     #     #AddEncoding x-compress .Z     #AddEncoding x-gzip .gz .tgz     #     # If the AddEncoding directives above are commented-out, then you     # probably should define those extensions to indicate media types:     #     AddType application/x-compress .Z     AddType application/x-gzip .gz .tgz     #     # AddHandler allows you to map certain file extensions to "handlers":     # actions unrelated to filetype. These can be either built into the server     # or added with the Action directive (see below)     #     # To use CGI scripts outside of ScriptAliased directories:     # (You will also need to add "ExecCGI" to the "Options" directive.)     #     #AddHandler cgi-script .cgi     # For type maps (negotiated resources):     #AddHandler type-map var     #     # Filters allow you to process content before it is sent to the client.     #     # To parse .shtml files for server-side includes (SSI):     # (You will also need to add "Includes" to the "Options" directive.)     #     #AddType text/html .shtml     #AddOutputFilter INCLUDES .shtml </IfModule> # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type.  The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" # # # MaxRanges: Maximum number of Ranges in a request before # returning the entire resource, or one of the special # values 'default', 'none' or 'unlimited'. # Default setting is to accept 200 Ranges. #MaxRanges unlimited # # EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files.  This usually improves server performance, but must # be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on # Supplemental configuration # # The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary. # Server-pool management (MPM specific) #Include conf/extra/httpd-mpm.conf # Multi-language error messages #Include conf/extra/httpd-multilang-errordoc.conf # Fancy directory listings #Include conf/extra/httpd-autoindex.conf # Language settings #Include conf/extra/httpd-languages.conf # User home directories #Include conf/extra/httpd-userdir.conf # Real-time info on requests and configuration #Include conf/extra/httpd-info.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav.conf # Various default settings #Include conf/extra/httpd-default.conf # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/proxy-html.conf </IfModule> # Secure (SSL/TLS) connections Include conf/extra/httpd-ssl.conf # # Note: The following must must be present to support #       starting without SSL on platforms with no /dev/random equivalent #       but a statically compiled-in mod_ssl. # <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> ------------------------- Re回 8楼dongshan8的帖子 # Virtual Hosts # # Required modules: mod_log_config # 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. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerAdmin www.qipaifan.com DocumentRoot " ServerName www.qipaifan.com <Directory /> AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin bbs.qipaifan.com DocumentRoot "/ ServerName bbs.qipaifan.com <Directory /> AllowOverride all Require all granted </Directory> </VirtualHost> ------------------------- Re回 8楼dongshan8的帖子 ssl配置文件发不上来      发图片吧        我没发现有什么异常啊...

淘乐网络 2019-12-02 00:26:30 0 浏览量 回答数 0

回答

Relocalhost和127.0.0.1都无法正常访问 引用第2楼dongshan8于2016-04-19 10:05发表的  : 楼主您好, 能贴出您的 apache 配置文件内容吗? 您是如何布置的 apache + php + mysql 的呢?是手工安装,还是用自动安装脚本来安装的? ....... [url=https://bbs.aliyun.com/job.php?action=topost&tid=277757&pid=779671][/url] 版主来了, 太感动了, 多谢!!!    httpd.conf ## This is the main Apache HTTP server configuration file.  It contains the# configuration directives that give the server its instructions.# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.# In particular, see # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html># for a discussion of each configuration directive.## Do NOT simply read the instructions in here without understanding# what they do.  They're here only as hints or reminders.  If you are unsure# consult the online docs. You have been warned.  ## Configuration and logfile names: If the filenames you specify for many# of the server's control files begin with "/" (or "drive:/" for Win32), the# server will use that explicit path.  If the filenames do *not* begin# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"# with ServerRoot set to "D:/WAMP/apache" will be interpreted by the# server as "D:/WAMP/apache/logs/foo.log".## NOTE: Where filenames are specified, you must use forward slashes# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").# If a drive letter is omitted, the drive on which httpd.exe is located# will be used by default.  It is recommended that you always supply# an explicit drive letter in absolute paths to avoid confusion.## ServerRoot: The top of the directory tree under which the server's# configuration, error, and log files are kept.## Do not add a slash at the end of the directory path.  If you point# ServerRoot at a non-local disk, be sure to point the LockFile directive# at a local disk.  If you wish to share the same ServerRoot for multiple# httpd daemons, you will need to change at least LockFile and PidFile.#ServerRoot "D:/WAMP/apache"## Listen: Allows you to bind Apache to specific IP addresses and/or# ports, instead of the default. See also the <VirtualHost># directive.## Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses.##Listen 12.34.56.78:80Listen 80## Dynamic Shared Object (DSO) Support## To be able to use the functionality of a module which was built as a DSO you# have to place corresponding `LoadModule' lines at this location so the# directives contained in it are actually available _before_ they are used.# Statically compiled modules (those listed by `httpd -l') do not need# to be loaded here.## Example:# LoadModule foo_module modules/mod_foo.so#LoadModule actions_module modules/mod_actions.soLoadModule alias_module modules/mod_alias.soLoadModule asis_module modules/mod_asis.soLoadModule auth_basic_module modules/mod_auth_basic.so#LoadModule auth_digest_module modules/mod_auth_digest.so#LoadModule authn_alias_module modules/mod_authn_alias.so#LoadModule authn_anon_module modules/mod_authn_anon.so#LoadModule authn_dbd_module modules/mod_authn_dbd.so#LoadModule authn_dbm_module modules/mod_authn_dbm.soLoadModule authn_default_module modules/mod_authn_default.soLoadModule authn_file_module modules/mod_authn_file.so#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so#LoadModule authz_dbm_module modules/mod_authz_dbm.soLoadModule authz_default_module modules/mod_authz_default.soLoadModule authz_groupfile_module modules/mod_authz_groupfile.soLoadModule authz_host_module modules/mod_authz_host.so#LoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule autoindex_module modules/mod_autoindex.so#LoadModule cache_module modules/mod_cache.so#LoadModule cern_meta_module modules/mod_cern_meta.soLoadModule cgi_module modules/mod_cgi.so#LoadModule charset_lite_module modules/mod_charset_lite.so#LoadModule dav_module modules/mod_dav.so#LoadModule dav_fs_module modules/mod_dav_fs.so#LoadModule dav_lock_module modules/mod_dav_lock.so#LoadModule dbd_module modules/mod_dbd.soLoadModule deflate_module modules/mod_deflate.soLoadModule dir_module modules/mod_dir.so#LoadModule disk_cache_module modules/mod_disk_cache.so#LoadModule dumpio_module modules/mod_dumpio.soLoadModule env_module modules/mod_env.soLoadModule expires_module modules/mod_expires.so#LoadModule ext_filter_module modules/mod_ext_filter.so#LoadModule file_cache_module modules/mod_file_cache.soLoadModule filter_module modules/mod_filter.soLoadModule headers_module modules/mod_headers.so#LoadModule ident_module modules/mod_ident.so#LoadModule imagemap_module modules/mod_imagemap.soLoadModule include_module modules/mod_include.so#LoadModule info_module modules/mod_info.soLoadModule isapi_module modules/mod_isapi.so#LoadModule ldap_module modules/mod_ldap.so#LoadModule logio_module modules/mod_logio.soLoadModule log_config_module modules/mod_log_config.so#LoadModule log_forensic_module modules/mod_log_forensic.so#LoadModule mem_cache_module modules/mod_mem_cache.soLoadModule mime_module modules/mod_mime.so#LoadModule mime_magic_module modules/mod_mime_magic.soLoadModule negotiation_module modules/mod_negotiation.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_ftp_module modules/mod_proxy_ftp.so#LoadModule proxy_http_module modules/mod_proxy_http.so#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so#LoadModule reqtimeout_module modules/mod_reqtimeout.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule setenvif_module modules/mod_setenvif.so#LoadModule speling_module modules/mod_speling.soLoadModule ssl_module modules/mod_ssl.so#LoadModule status_module modules/mod_status.so#LoadModule substitute_module modules/mod_substitute.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 version_module modules/mod_version.so#LoadModule vhost_alias_module modules/mod_vhost_alias.so<IfModule !mpm_netware_module><IfModule !mpm_winnt_module>## If you wish httpd to run as a different user or group, you must run# httpd as root initially and it will switch.  ## User/Group: The name (or #number) of the user/group to run httpd as.# It is usually good practice to create a dedicated user and group for# running httpd, as with most system services.#User daemonGroup daemon</IfModule></IfModule># 'Main' server configuration## The directives in this section set up the values used by the 'main'# server, which responds to any requests that aren't handled by a# <VirtualHost> definition.  These values also provide defaults for# any <VirtualHost> containers you may define later in the file.## All of these directives may appear inside <VirtualHost> containers,# in which case these default settings will be overridden for the# virtual host being defined.### ServerAdmin: Your address, where problems with the server should be# e-mailed.  This address appears on some server-generated pages, such# as error documents.  e.g. admin@your-domain.com#ServerAdmin scp1688@163.com## 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 your host doesn't have a registered DNS name, enter its IP address here.#ServerName www.phpStudy.net:80## DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot  "D:\WAMP\WWW"## Each directory to which Apache has access can be configured with respect# to which services and features are allowed and/or disabled in that# directory (and its subdirectories). ## First, we configure the "default" to be a very restrictive set of # features.  #<Directory />  Options FollowSymLinks    AllowOverride All    Order deny,allow    Allow from all</Directory>## Note that from this point forward you must specifically allow# particular features to be enabled - so if something's not working as# you might expect, make sure that you have specifically enabled it# below.### This should be changed to whatever you set DocumentRoot to.#<Directory "D:\WAMP\WWW">    #    # Possible values for the Options directive are "None", "All",    # or any combination of:    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews    #    # Note that "MultiViews" must be named *explicitly* --- "Options All"    # doesn't give it to you.    #    # The Options directive is both complicated and important.  Please see    # http://httpd.apache.org/docs/2.2/mod/core.html#options    # for more information.    #    Options FollowSymLinks    #    # AllowOverride controls what directives may be placed in .htaccess files.    # It can be "All", "None", or any combination of the keywords:    #   Options FileInfo AuthConfig Limit    #    AllowOverride All    #    # Controls who can get stuff from this server.    #    Order allow,deny    Allow from all</Directory>## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#<IfModule dir_module>    DirectoryIndex index.html index.php index.htm</IfModule>## The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. #<FilesMatch "^\.ht">    Order allow,deny    Deny from all    Satisfy All</FilesMatch>## ErrorLog: The location of the error log file.# If you do not specify an ErrorLog directive within a <VirtualHost># container, error messages relating to that virtual host will be# logged here.  If you *do* define an error logfile for a <VirtualHost># container, that host's errors will be logged there and not here.#ErrorLog "logs/error.log"## LogLevel: Control the number of messages logged to the error_log.# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg.#LogLevel warn<IfModule log_config_module>    #    # The following directives define some format nicknames for use with    # a CustomLog directive (see below).    #    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>      # You need to enable mod_logio.c to use %I and %O      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio    </IfModule>    #    # The location and format of the access logfile (Common Logfile Format).    # If you do not define any access logfiles within a <VirtualHost>    # container, they will be logged here.  Contrariwise, if you *do*    # define per-<VirtualHost> access logfiles, transactions will be    # logged therein and *not* in this file.    #    CustomLog "logs/access.log" common    #    # If you prefer a logfile with access, agent, and referer information    # (Combined Logfile Format) you can use the following directive.    #    #CustomLog "logs/access.log" combined</IfModule><IfModule alias_module>    #    # Redirect: Allows you to tell clients about documents that used to     # exist in your server's namespace, but do not anymore. The client     # will make a new request for the document at its new location.    # Example:    # Redirect permanent /foo http://www.phpStudy.net/bar    #    # Alias: Maps web paths into filesystem paths and is used to    # access content that does not live under the DocumentRoot.    # Example:    # Alias /webpath /full/filesystem/path    #    # If you include a trailing / on /webpath then the server will    # require it to be present in the URL.  You will also likely    # need to provide a <Directory> section to allow access to    # the filesystem path.    #    # ScriptAlias: This controls which directories contain server scripts.     # ScriptAliases are essentially the same as Aliases, except that    # documents in the target directory are treated as applications and    # run by the server when requested rather than as documents sent to the    # client.  The same rules about trailing "/" apply to ScriptAlias    # directives as to Alias.    #    ScriptAlias /cgi-bin/ "D:/WAMP/apache/cgi-bin/"</IfModule><IfModule cgid_module>    #    # ScriptSock: On threaded servers, designate the path to the UNIX    # socket used to communicate with the CGI daemon of mod_cgid.    #    #Scriptsock logs/cgisock</IfModule>## "D:/WAMP/apache/cgi-bin" should be changed to whatever your ScriptAliased# CGI directory exists, if you have that configured.#<Directory "D:/WAMP/apache/cgi-bin">    AllowOverride All    Options None    Order allow,deny    Allow from all</Directory>## DefaultType: the default MIME type the server will use for a document# if it cannot otherwise determine one, such as from filename extensions.# If your server contains mostly text or HTML documents, "text/plain" is# a good value.  If most of your content is binary, such as applications# or images, you may want to use "application/octet-stream" instead to# keep browsers from trying to display binary files as though they are# text.#DefaultType text/plain<IfModule mime_module>    #    # TypesConfig points to the file containing the list of mappings from    # filename extension to MIME-type.    #    TypesConfig conf/mime.types    #    # AddType allows you to add to or override the MIME configuration    # file specified in TypesConfig for specific file types.    #    #AddType application/x-gzip .tgz    #    # AddEncoding allows you to have certain browsers uncompress    # information on the fly. Note: Not all browsers support this.    #    #AddEncoding x-compress .Z    #AddEncoding x-gzip .gz .tgz    #    # If the AddEncoding directives above are commented-out, then you    # probably should define those extensions to indicate media types:    #    AddType application/x-compress .Z    AddType application/x-gzip .gz .tgz    #    # AddHandler allows you to map certain file extensions to "handlers":    # actions unrelated to filetype. These can be either built into the server    # or added with the Action directive (see below)    #    # To use CGI scripts outside of ScriptAliased directories:    # (You will also need to add "ExecCGI" to the "Options" directive.)    #    #AddHandler cgi-script .cgi    # For type maps (negotiated resources):    #AddHandler type-map var    #    # Filters allow you to process content before it is sent to the client.    #    # To parse .shtml files for server-side includes (SSI):    # (You will also need to add "Includes" to the "Options" directive.)    #    #AddType text/html .shtml    #AddOutputFilter INCLUDES .shtml</IfModule>## The mod_mime_magic module allows the server to use various hints from the# contents of the file itself to determine its type.  The MIMEMagicFile# directive tells the module where the hint definitions are located.##MIMEMagicFile conf/magic## Customizable error responses come in three flavors:# 1) plain text 2) local redirects 3) external redirects## Some examples:#ErrorDocument 500 "The server made a boo boo."#ErrorDocument 404 /missing.html#ErrorDocument 404 "/cgi-bin/missing_handler.pl"#ErrorDocument 402 http://www.phpStudy.net/subscription_info.html### MaxRanges: Maximum number of Ranges in a request before# returning the entire resource, or 0 for unlimited# Default setting is to accept 200 Ranges#MaxRanges 0## EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall is used to deliver# files.  This usually improves server performance, but must# be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise# broken on your system.##EnableMMAP off#EnableSendfile off# Supplemental configuration## The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary.# Server-pool management (MPM specific)Include conf/extra/httpd-mpm.conf# Multi-language error messages#Include conf/extra/httpd-multilang-errordoc.conf# Fancy directory listings#Include conf/extra/httpd-autoindex.conf# Language settings#Include conf/extra/httpd-languages.conf# User home directories#Include conf/extra/httpd-userdir.conf# Real-time info on requests and configuration#Include conf/extra/httpd-info.conf# Virtual hostsInclude conf/extra/httpd-vhosts.conf# Local access to the Apache HTTP Server Manual#Include conf/extra/httpd-manual.conf# Distributed authoring and versioning (WebDAV)#Include conf/extra/httpd-dav.conf# Various default settings#Include conf/extra/httpd-default.confInclude conf/phpmyadmin.confInclude conf/vhosts.conf# Secure (SSL/TLS) connections#Include conf/extra/httpd-ssl.conf## Note: The following must must be present to support#       starting without SSL on platforms with no /dev/random equivalent#       but a statically compiled-in mod_ssl.#LoadFile "D:/WAMP/PHP/php5ts.dll"LoadModule php5_module "D:/WAMP/PHP/php5apache2_2.dll"<IfModule php5_module>    PHPIniDir "D:/WAMP/PHP/"    AddType application/x-httpd-php .php .phtml</IfModule>LoadFile "D:/WAMP/PHP/libmysql.dll"LoadFile "D:/WAMP/PHP/libmcrypt.dll"<IfModule ssl_module>SSLRandomSeed startup builtinSSLRandomSeed connect builtin</IfModule><IfModule mod_Rewrite.c>RewriteEngine OnRewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2</IfModule><ifmodule mod_deflate.c>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript</ifmodule>TraceEnable off<IfModule deflate_module>SetOutputFilter DEFLATE# Don’t compress images and otherSetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-varySetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-varySetEnvIfNoCase Request_URI .(?:pdf|doc)$ no-gzip dont-varyAddOutputFilterByType DEFLATE text/html text/plain text/xml text/cssAddOutputFilterByType DEFLATE application/x-javascript</IfModule> ------------------------- Relocalhost和127.0.0.1都无法正常访问 哦, 我找到了, 默认目录修改之后这里没有跟上, 感谢版主的帮助, 谢谢!

tunawt 2019-12-02 02:35:55 0 浏览量 回答数 0

问题

sql数据提交到库问题双条数据,求高手解? 400 报错

爱吃鱼的程序员 2020-06-01 11:31:12 0 浏览量 回答数 1

回答

详细信息 mod_expires模块设置 Apache可以通过配置文件的mod_expires模块控制HTTP协议的Expires和Cache-Control头部信息。mod_expires模块的主要作用是自动生成页面头部信息中的Expires标签和Cache-Control标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的。 mod_expires模块的介绍 mod_expires是Apache众多模块中配置比较简单的模块,一共有以下三条指令。 ExpiresActive指令:打开或关闭产生Expires和Cache-Control标签的功能。 ExpiresByType指令:指定MIME类型文档的过期时间,例如text/html文档。 ExpiresDefault指令:所有文档的默认过期时间。 过期时间的写法如下。 access plus 1 month access plus 4 weeks now plus 30 days modification plus 5 hours 3 minutes A2592000 M604800 提示: access plus 1 month、access plus 4 weeks、now plus 30 days和A2592000写法的意义相同,指过期时间是从访问时开始计算。 modification plus 5 hours 3 minutes和M604800意义相同,指过期时间是以被访问文件的最后修改时间开始计算。 M604800只对静态文件起作用,脚本生成的动态页面不起作用。 配置示例 mod_expires模块的配置如下所示。 ExpiresActive On:开启mod_expires功能。 ExpiresDefault "access plus 6 months":默认的过期时间是6个月。 ExpiresByType image/* "access plus 10 years":图片的文件类型缓存时间为10年。 ExpiresByType text/* "access plus 10 years":文本类型缓存时间为10年。 ExpiresByType application/* "access plus 30 minutes":application文件类型缓存30分钟。 访问image/jpeg类型的缓存时间为315360000秒,即10年,如下所示。 缓存时间验证 如果将image/jpeg类型设置为不缓存,即将max-age设置为0秒,配置如下所示。 #ExpiresByType image/* "access plus 10 years" ExpiresByType image/* A0 再次访问时,发现缓存时间为0秒。 max-age mod_headers模块设置 mod_headers模块配置示例如下所示,详细介绍请参考Apache官方网站。 YEAR Header set Cache-Control "max-age=2592000″ WEEK Header set Cache-Control "max-age=604800″ NEVER CACHE Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT" Header set Cache-Control "no-store, no-cache, must-revalidate" Header set Pragma "no-cache"

保持可爱mmm 2020-03-30 14:59:20 0 浏览量 回答数 0

回答

配置IIS7/IIS8服务器 下载并解压 F5XForwardedFor文件。 根据自己的服务器操作系统版本将x86\Release或x64\Release目录下的F5XFFHttpModule.dll和F5XFFHttpModule.ini拷贝到某个目录,例如C:\F5XForwardedFor\。确保IIS进程对该目录有读取权限。 打开IIS管理器,双击模块功能。 单击配置本机模块,然后在弹出的对话框中,单击注册。 添加下载的.dll文件。 为添加的两个文件授权允许运行ISAPI和CGI扩展。 说明 确保您已经安装了ISAPI和CGI应用程序。 重启IIS服务器,等待配置生效。 配置Apache服务器 执行如下命令,安装Apache的一个第三方模块mod_rpaf。 wget https://github.com/gnif/mod_rpaf/archive/v0.6.0.tar.gz tar zxvf mod_rpaf-0.6.tar.gz cd mod_rpaf-0.6 /alidata/server/httpd/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c 修改Apache的配置文件/alidata/server/httpd/conf/httpd.conf,在最末尾添加以下配置信息。 LoadModule rpaf_module modules/mod_rpaf-2.0.so RPAFenable On RPAFsethostname On RPAFproxy_ips <IP_address> RPAFheader X-Forwarded-For 说明 如果您要获取代理服务器的地址,可以将代理服务器的网段添加到RPAFproxy_ips <IP_address>,如负载均衡的IP地址段100.64.0.0/10(100.64.0.0/10 是阿里云保留地址,其他用户无法分配到该网段内,不会存在安全风险)和高防IP地址段。多个IP地址段用逗号分隔。 添加完成后重启Apache。 /alidata/server/httpd/bin/apachectl restart 配置Nginx服务器 执行如下命令,安装http_realip_module。 wget http://nginx.org/download/nginx-1.0.12.tar.gz tar zxvf nginx-1.0.12.tar.gz cd nginx-1.0.12 ./configure --user=www --group=www --prefix=/alidata/server/nginx --with-http_stub_status_module --without-http-cache --with-http_ssl_module --with-http_realip_module make make install kill -USR2 cat /alidata/server/nginx/logs/nginx.pid kill -QUIT cat /alidata/server/nginx/logs/ nginx.pid.oldbin 执行如下命令,打开nginx.conf文件。 vi /alidata/server/nginx/conf/nginx.conf 在以下配置信息后添加新的配置字段和信息。 fastcgi connect_timeout 300; fastcgi send_timeout 300; fastcgi read_timeout 300; fastcgi buffer_size 64k; fastcgi buffers 4 64k; fastcgi busy_buffers_size 128k; fastcgi temp_file_write_size 128k; 需要添加的配置字段和信息为: set_real_ip_from IP_address real_ip_header X-Forwarded-For; 说明 如果您要获取代理服务器的地址,可以将代理服务器的网段添加到set_real_ip_from <IP_address>,如负载均衡的IP地址段100.64.0.0/10(100.64.0.0/10 是阿里云保留地址,其他用户无法分配到该网段内,不会存在安全风险)和高防IP地址段。多个IP地址段用逗号分隔。 执行如下命令,重启Nginx。 /alidata/server/nginx/sbin/nginx -s reload

保持可爱mmm 2020-03-30 09:50:00 0 浏览量 回答数 0

问题

PHP加速 eAccelerator 配置和使用指南:配置报错 

kun坤 2020-06-02 15:46:18 0 浏览量 回答数 1

问题

PHP加速 eAccelerator 配置和使用指南 :报错

kun坤 2020-06-14 16:05:07 1 浏览量 回答数 1

问题

PHP加速 eAccelerator 配置和使用指南,报错

一枚小鲜肉帅哥 2020-05-27 21:24:00 6 浏览量 回答数 1

问题

PHP加速 eAccelerator 配置和使用指南 - php报错

montos 2020-06-03 22:25:14 1 浏览量 回答数 1

问题

PHP加速 eAccelerator 配置和使用指南-php报错

montos 2020-06-01 18:18:52 0 浏览量 回答数 1

问题

获取客户端真实IP

行者武松 2019-12-01 21:36:57 4337 浏览量 回答数 2

问题

或许是 2017年 最新的 ngx_pagespeed 安装姿势

妙正灰 2019-12-01 21:58:18 4013 浏览量 回答数 2

回答

回 17楼dongshan8的帖子 我在使用弹性web托管服务也遇到同样的问题。php缓存模式正常,但启用mod_rewrite模式就出现楼主同样的问题。网上资料说apache2.4下自动生成的伪静态会有这样的情况。请问下有办法解决吗?谢谢 ------------------------- Rewordpress安装wp super cache不成功 mod_rewrite模式性能比php缓存模式性能要翻一倍,这也是一直纠结怎么开启mod_rewrite模式的原因。 ------------------------- 回 27楼dongshan8的帖子 不是。 是安装wp super cache后,启用mod_rewrite模式会导致网站无法访问。测试缓存会出现“页面不相符!时间戳有差异或者不存在!”错误。 版本号为WordPress 4.5.7+WP Super Cache1.4.9 ------------------------- 回 27楼dongshan8的帖子 wp super cache里面在这打开mod_rewrite模式。 版主大大能否帮忙基于您现有的版本验证下?谢谢! ------------------------- 回 30楼dongshan8的帖子 好的,非常感谢。

javenzy 2019-12-02 01:55:36 0 浏览量 回答数 0

问题

LAMP一键安装包加装modssl

himyblue 2019-12-01 21:26:15 6516 浏览量 回答数 0

问题

带有express和node.js的RestFul应用程序接口在每次修复时都会崩溃?

┭┮﹏┭┮ 2019-12-31 20:48:48 0 浏览量 回答数 0

问题

修改了php.ini各种重启依旧无效:配置报错 

kun坤 2020-06-04 10:23:30 4 浏览量 回答数 1

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:44 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:44 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:44 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:43 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:44 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:45 0 浏览量 回答数 0

回答

详细解答可以参考官方帮助文档过期时间控制支持三个维度,优先级依次为控制台设置——源站header设置——cache的默认策略设置cdn缓存规则参考:https://help.aliyun.com/document_detail/cdn/getting-started/set/set-cachepolicy.html?spm=5176.doccdn/getting-started/httpsdelivery.6.106.yJalap 控制台过期时间设置详见【域名过期时间设置】,源站设置详见【webserver缓存策略设置】,cache的默认策略是针对用户既没有在控制台设置过期时间,也没有在源站设置过期时间,会走一个默认的全局策略,既保证加速效果,又避免因为动态的文件缓存导致的问题详见【Cache的默认缓存策略】。Webserver缓存策略设置一、IIS 缓存策略设置1、 因为整体的站点只对.html .jpg .png .gif .apk文件,而其他文件都不缓存;可以首先对整个站点设置成不缓存,设置如下:a)打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,然后选择“HTTP头“选卡,勾选“启用内容过期”,并选择“立即过期”,然后“确定”,具体如下:  b)经过上述设置后整个网站的内容都不会被CDN缓存,然后对.html .jpg .png .gif .apk文件类型设置缓存策略  2、针对特定文件的缓存设置如下:a)如果上面不同扩展名的文件都单独放在一个特定的目录下面,且该目录没有其他扩展名的文件,那么可以针对这个扩展名所在的整个目录设置缓存的时间;具体方法是在“IIS信息管理器”中,展开网站“a.cc.com”的目录,选中需要设置缓存时间的目录,比如所有jpg都存储在img这个目录下,那么右键点击该目录,选择“属性’,选中”HTTP头“选卡;因为刚才整个网站都设置了不缓存的设置,因此这时打开该目录的”HTTP头“的缓存设置和1中的一致,接下来就有修改这个配置:选择”此时间段后过期“,并且将时间设置为过期的时间值,比如14天,点击“确定”保存,具体如下:  b) 如果特定扩展名的文件不是统一放在唯一的目录下,是和其他扩展名文件混合放在一个目录下面的,这种情况配置要复杂一些;  为了避免针对特定扩展名的文件进行逐个的配置,我们需要让IIS支持“通配符”,支持“通配符”的配置如下:1) 打开“IIS信息管理器”,右键点击服务网站“a.cc.com”的属性,选择“主目录”选卡,点击选卡上的“配置”按钮,出现如下对话框:  2) 在“通配符应用程序映射(执行顺序)”一栏下面,点击“插入”按钮,在弹出的文件选择框时选择 C: \WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 文件,其中“C:”是系统盘,不要勾选“确认文件是否存在”,具体如下:  连续两个“确定”按键点击后,就完成了IIS通配符的支持配置 3)接下来就是到存在需要进行缓存配置文件的目录下面,首先选择一个需要缓存扩展名的文件,点击右键,选择属性,选择“HTTP头”选卡,进行2.a)中的配置,并保存;接下来就有对这个文件目录下面所有相同扩展名的文件进行该设置了,此时需要修改IIS的配置文件实现。 4)IIS的配置文件放置在C:\WINDOWS\system32\inetsrv\MetaBase.xml(IIS6的设置),用“记事本”程序打开上述文件,如果我们3)中是针对bin目录下面的test.jpg做了缓存过期时间的设置的,那么我们就查找字串“/bin/test.jpg“,就可以在该文件中找到bin目录下test.jpg文件的缓存设置,为了使bin目录下面所有的jpg文件都采用该缓存设置,只需要将“test.jpg”改为”*.jpg“就可以了,然后保持该文件。注意要修改上述文件,需要在“服务”中关闭“IIS admin Service”。 5)其他扩展名的文件缓存设置可以重复上面的3)和4)操作。 二、Nginx 缓存策略设置HTTP头处理模块(HTTP Headers),这个模块允许设置任意的HTTP头 1) add_header语法:add_header name value 默认值:none 使用字段:http, server, location 2) expires语法:expires [time|epoch|max|off] 默认值:expires off 使用字段:http, server, location  这个指令控制是否在应答中标记一个过期时间,如果是,如何标记。off 将禁止修改头部中的 Expires和Cache-Control字段。Time控制“Cache-Control”的值,负数表示no-cacheepoch 将Expires头设置为1 January, 1970 00:00:01 GMT。max 将Expires头设置为31 December 2037 23:59:59 GMT,将Cache-Control最大化到10 年。 例如设置php的文件类型过期时间设置为1个小时:        设置php的文件类型为no-cache,不让cache服务器缓存:    另外可以通过add_header设置相对应的缓存策略,对于动态的php文件设置为不缓存: location ~ .*\.php$ {    if ($request_uri !~ ^/dynamicimg/) {        add_header              Cache-Control "no-cache";        add_header              Pragma no-cache;    }  } 三、Apache缓存策略设置 Apache的过期策略可以通过apache的mod_expires和mod_headers两个模块设置: 1)模块mod_expires设置:允许通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容mod_expires 模块的主要作用是自动生成页面头部信息中的 Expires 标签和 Cache-Control 标签,从而降低客户端的访问频率和次数,达到减少不必要流量和增加访问速度的目的mod_expires 是 apache 众多模块中配置比较简单的一个,它一共只有三条指令ExpiresActive 指令:打开或关闭产生”Expires:”和”Cache-Control:”头的功能。ExpiresByType 指令:指定MIME类型的文档(例如:text/html)的过期时间。ExpiresDefault 指令:默认所有文档的过期时间。 过期时间的写法“access plus 1 month”“access plus 4 weeks”“now plus 30 days”“modification plus 5 hours 3 minutes”A2592000M604800access、now及A 三种写法的意义相同,指过期时间从访问时开始计算。modification及M 的意义相同,指过期时间是以被访问文件的最后修改时间开始计算。所以,后一种写法只对静态文件起作用,而由脚本生成的动态页面不受它的作用 配置实例:     ExpiresActive On(开启mod_expires功能)    ExpiresDefault "access plus 6 months"(默认的过期时间是6个月)    ExpiresByType image/* "access plus 10 years"(图片的文件类型缓存时间为10年)    ExpiresByType text/* "access plus 10 years"(文本类型缓存时间为10年)    ExpiresByType application/* "access plus 30 minutes"(application文件类型缓存30分钟) 验证:image/jpeg 缓存时间为315360000s(10年)  如果将image/jpeg设置为不缓存(将max-age设置为0s): #   ExpiresByType image/* "access plus 10 years"ExpiresByType image/*  A0   2)模块mod_headers设置:   # YEAR(flv,gif,ico文件类型的缓存时间为1年)Header set Cache-Control “max-age=2592000″# WEEK(pdf.swf,js,css缓存时间为一周)Header set Cache-Control “max-age=604800″# NEVER CACHE(jsp.swf,ico文件类型不缓存)Header set Expires “Thu, 01 Dec 2003 16:00:00 GMT”Header set Cache-Control “no-store, no-cache, must-revalidate”Header set Pragma “no-cache”  Cache的默认缓存策略缓存时间计算t =(savetime - last_modified)*0.1 t = min(10, t) t = max(t, 3600)缓存时间为t,单位秒 1、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:01:00, (curtime-Last_modified)*0.1=6s,那么缓存时间为10s,因为最小值为10s2、当对象last-modified为20140801 00:00:00,当前时间为20140802 00:00:00,(curtime-Last_modified)*0.1=8640s,那么缓存时间为3600s3、当对象last-modified为20140801 00:00:00,当前时间为20140801 00:10:00,(curtime-Last_modified)*0.1=60s,那么缓存时间为60s4、如果源站没有 Last-Modified 响应头,但有 ETag,则该对象极有可能是静态资源,将其默认缓存时间设置为 dft_expires 指令配置的最小值5、如果源站没有 Last-Modified,也没有 ETag,则认为该对象为动态内容,将其默认缓存时间设置为 0,每次都回源  注意事项因为网站开发及其相关技术人员更清楚自身网站的业务逻辑,静态和动态因素,所以建议用户通过控制台按照文件类型,目录控制设置缓存时间控制;如果用户控制有缓存策略控制,Cache的默认缓存策略就不生效。  如果问题还未能解决,请联系售后技术支持。

2019-12-01 23:32:45 0 浏览量 回答数 0
阿里云大学 云服务器ECS com域名 网站域名whois查询 开发者平台 小程序定制 小程序开发 国内短信套餐包 开发者技术与产品 云数据库 图像识别 开发者问答 阿里云建站 阿里云备案 云市场 万网 阿里云帮助文档 免费套餐 开发者工具 企业信息查询 小程序开发制作 视频内容分析 企业网站制作 视频集锦 代理记账服务 企业建站模板