我已在AEM上的本地配置了调度程序,现在正在尝试URL http://www.mywebapp.com(此条目也在hosts文件中生成)。这是我得到的错误
[Tue Mar 10 12:25:43 2015] [D] [7268(496)] Found farm website for www.mywebapp.com
[Tue Mar 10 12:25:43 2015] [D] [7268(496)] checking [/]
[Tue Mar 10 12:25:43 2015] [D] [7268(496)] request URL has no extension: /
[Tue Mar 10 12:25:43 2015] [D] [7268(496)] cache-action for [/]: NONE
[Tue Mar 10 12:25:43 2015] [D] [7268(496)] Filter rejects: GET / HTTP/1.1
[Tue Mar 10 12:25:43 2015] [I] [7268(496)] "GET /" - - 1ms
这是dispatcher.any文件。我不确定哪个过滤器正好阻止了请求:
# Each farm configures a set of load balanced renders (i.e. remote servers)
/farms
{
# First farm entry
/website
{
# Request headers that should be forwarded to the remote server.
/clientheaders
{
# Forward all request headers that are end-to-end. If you want
# to forward a specific set of headers, you'll have to list
# them here.
"*"
}
# Hostname globbing for farm selection (virtual domain addressing)
/virtualhosts
{
# Entries will be compared against the "Host" request header
# and an optional request URL prefix.
#
# Examples:
#
# www.company.com
# intranet.*
# myhost:8888/mysite
"*"
}
# The load will be balanced among these render instances
/renders
{
/rend01
{
# Hostname or IP of the render
/hostname "127.0.0.1"
# Port of the render
/port "4503"
# Connect timeout in milliseconds, 0 to wait indefinitely
# /timeout "0"
}
}
# The filter section defines the requests that should be handled by the dispatcher.
# The globs will be compared against the request line, e.g. "GET /index.html HTTP/1.1".
/filter
{
# Deny everything first and then allow specific entries
/0001 { /type "deny" /glob "*" }
# Open consoles
# /0011 { /type "allow" /glob "* /admin/*" } # allow servlet engine admin
# /0012 { /type "allow" /glob "* /crx/*" } # allow content repository
# /0013 { /type "allow" /glob "* /system/*" } # allow OSGi console
# Allow non-public content directories
# /0021 { /type "allow" /glob "* /apps/*" } # allow apps access
# /0022 { /type "allow" /glob "* /bin/*" }
/0023 { /type "allow" /glob "* /content*" } # disable this rule to allow mapped content only
# /0024 { /type "allow" /glob "* /libs/*" }
# /0025 { /type "deny" /glob "* /libs/shindig/proxy*" } # if you enable /libs close access to proxy
# /0026 { /type "allow" /glob "* /home/*" }
# /0027 { /type "allow" /glob "* /tmp/*" }
# /0028 { /type "allow" /glob "* /var/*" }
# Enable specific mime types in non-public content directories
/0041 { /type "allow" /glob "* *.css *" } # enable css
/0042 { /type "allow" /glob "* *.gif *" } # enable gifs
/0043 { /type "allow" /glob "* *.ico *" } # enable icos
/0044 { /type "allow" /glob "* *.js *" } # enable javascript
/0045 { /type "allow" /glob "* *.png *" } # enable png
/0046 { /type "allow" /glob "* *.swf *" } # enable flash
/0047 { /type "allow" /glob "* *.html *" } # enable flash
# Enable features
/0061 { /type "allow" /glob "POST /content/[.]*.form.html" } # allow POSTs to form selectors under content
/0062 { /type "allow" /glob "* /libs/cq/personalization/*" } # enable personalization
# Deny content grabbing
/0081 { /type "deny" /glob "GET *.infinity.json*" }
/0082 { /type "deny" /glob "GET *.tidy.json*" }
/0083 { /type "deny" /glob "GET *.sysview.xml*" }
/0084 { /type "deny" /glob "GET *.docview.json*" }
/0085 { /type "deny" /glob "GET *.docview.xml*" }
/0086 { /type "deny" /glob "GET *.*[0-9].json*" }
# /0087 { /type "allow" /glob "GET *.1.json*" } # allow one-level json requests
# Deny query
/0090 { /type "deny" /glob "* *.query.json*" }
}
# The cache section regulates what responses will be cached and where.
/cache
{
# The docroot must be equal to the document root of the webserver. The
# dispatcher will store files relative to this directory and subsequent
# requests may be "declined" by the dispatcher, allowing the webserver
# to deliver them just like static files.
/docroot "C:/Apache2.2/htdocs"
# Sets the level upto which files named ".stat" will be created in the
# document root of the webserver. When an activation request for some
# page is received, only files within the same subtree are affected
# by the invalidation.
/statfileslevel "3"
# Flag indicating whether to cache responses to requests that contain
# authorization information.
/allowAuthorized "1"
# Flag indicating whether the dispatcher should serve stale content if
# no remote server is available.
#/serveStaleOnError "0"
# The rules section defines what responses should be cached based on
# the requested URL. Please note that only the following requests can
# lead to cacheable responses:
#
# - HTTP method is GET
# - URL has an extension
# - Request has no query string
# - Request has no "Authorization" header (unless allowAuthorized is 1)
/rules
{
/0000
{
# the globbing pattern to be compared against the url
# example: * -> everything
# : /foo/bar.* -> only the /foo/bar documents
# : /foo/bar/* -> all pages below /foo/bar
# : /foo/bar[./]* -> all pages below and /foo/bar itself
# : *.html -> all .html files
/glob "*"
/type "allow"
}
}
# The invalidate section defines the pages that are "invalidated" after
# any activation. Please note that the activated page itself and all
# related documents are flushed on an modification. For example: if the
# page /foo/bar is activated, all /foo/bar.* files are removed from the
# cache.
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
# Consider all HTML files stale after an activation.
/glob "*.html"
/type "allow"
}
}
# The allowedClients section restricts the client IP addresses that are
# allowed to issue activation requests.
/allowedClients
{
# Uncomment the following to restrict activation requests to originate
# from "localhost" only.
#
#/0000
# {
# /glob "*"
# /type "deny"
# }
#/0001
# {
# /glob "127.0.0.1"
# /type "allow"
# }
}
}
# The statistics sections dictates how the load should be balanced among the
# renders according to the media-type.
/statistics
{
/categories
{
/html
{
/glob "*.html"
}
/others
{
/glob "*"
}
}
}
}
}
答案 0 :(得分:3)
你应该让mod_rewrite重定向你的" GET /"请求" GET /content/mywebapp/en.html" (以及其他规则)。 " GET /"无法缓存,因为它没有任何扩展名,您可能希望缓存主页。
答案 1 :(得分:1)
您有两种选择,设置apache以重定向/到您的主页(/content/myapp/home.html或等效的) 或者您可以使用资源解析器出厂设置来重写URL。
对于简单版本,请使用资源解析器映射。有关详细信息,请参阅此帖子:
http://www.aemmastery.com/2015/03/15/aem-osgi-service-dive-resource-resolver-factory/
答案 2 :(得分:1)
您可能需要一个类似于以下内容的虚拟主机文件:
<VirtualHost *:80>
ServerName www.mywebapp.com
DocumentRoot /var/www/html
ErrorDocument 404 /content/mywebapp/en/404.html
ErrorDocument 500 /content/mywebapp/en/500.html
RewriteEngine On
RewriteLog "logs/rewrite-www-mywebapp-com.log"
RewriteLogLevel 1
RewriteRule ^/en.html$ / [R=301,L]
RewriteRule ^/$ /content/mywebapp/en.html [PT]
RewriteCond %{REQUEST_URI} !^/etc(.*) [NC]
RewriteCond %{REQUEST_URI} !^/libs(.*) [NC]
RewriteCond %{REQUEST_URI} !^/content(.*) [NC]
RewriteCond %{REQUEST_URI} !^/system(.*) [NC]
RewriteCond %{REQUEST_URI} !^/dam(.*) [NC]
RewriteCond %{REQUEST_URI} !^/services(.*) [NC]
RewriteRule ^/(.*) /content/mywebapp/$1 [PT]
<Directory "/var/www/html">
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
因此,如果您访问www.mywebapp.com,则会创建并缓存文件/var/www/html/content/mywebapp/en.html。 如果你去www.mywebbapp.com/en/foo/bar.html, 文件/var/www/html/content/mywebapp/en/foo/bar.html已创建并缓存。
自定义上述文件以满足您的需求。
您可能还需要配置/ etc / mapping以满足您的URL重写需求。有关更多信息,请参阅此页面: https://docs.adobe.com/docs/en/aem/6-2/deploy/configuring/resource-mapping.html
答案 3 :(得分:0)
以下是我们为其中一个污染地点所做的一个例子
# first farm entry (label is not important, just for your convenience)
/cookbook
{
# client headers which should be passed through to the render instances
# (feature supported since dispatcher build 2.6.3.5222)
/clientheaders
{
"referer"
"user-agent"
"authorization"
"from"
"content-type"
"content-length"
"accept-charset"
"accept-encoding"
"accept-language"
"accept"
"host"
"if-match"
"if-none-match"
"if-range"
"if-unmodified-since"
"max-forwards"
"proxy-authorization"
"proxy-connection"
"range"
"cookie"
"cq-action"
"cq-handle"
"handle"
"action"
"cqstats"
"depth"
"translate"
"expires"
"date"
"dav"
"ms-author-via"
"if"
"lock-token"
"x-expected-entity-length"
"destination"
}
# hostname globbing for farm selection (virtual domain addressing)
/virtualhosts
{
# entries will be compared against the 'host' request header.
# example: www.company.com
# example: intranet.*
"*"
}
# the load will be balanced among these render instances
/renders
{
/publish1
{
# hostname or IP of the render
/hostname "localhost"
# port of the render
/port "4503"
# connect timeout in milliseconds, 0 to wait indefinitely
/timeout "0"
}
}
# only handle the requests in the following acl. default is 'none'
# the glob pattern is matched against the first request line
/filter
{
# deny everything and allow specific entries
/0001 { /type "deny" /glob "*" }
# open consoles
# /0012 { /type "allow" /glob "* /crx/*" } # allow content repository
# /0013 { /type "allow" /glob "* /system/*" } # allow OSGi console
# allow non-public content directories
# /0021 { /type "allow" /glob "* /apps/*" } # allow apps access
/0022 { /type "allow" /glob "* /bin/*" }
/0023 { /type "allow" /glob "* /content*" } # disable this rule to allow mapped content only
# /0024 { /type "allow" /glob "* /libs/*" }
# /0025 { /type "deny" /glob "* /libs/shindig/proxy*" } # if you enable /libs close access to proxy
# /0026 { /type "allow" /glob "* /home/*" }
# /0027 { /type "allow" /glob "* /tmp/*" }
# /0028 { /type "allow" /glob "* /var/*" }
# enable specific mime types in non-public content directories
/0041 { /type "allow" /glob "* *.css *" } # enable css
/0042 { /type "allow" /glob "* *.gif *" } # enable gifs
/0043 { /type "allow" /glob "* *.ico *" } # enable icos
/0044 { /type "allow" /glob "* *.js *" } # enable javascript
/0045 { /type "allow" /glob "* *.png *" } # enable png
/0046 { /type "allow" /glob "* *.swf *" } # enable flash
/0047 { /type "allow" /glob "* *.svg *" } # enable SVG
/0048 { /type "allow" /glob "* *.woff *" } # enable woff
/0049 { /type "allow" /glob "* *.ttf *" } # enable ttf
/0050 { /type "allow" /glob "* *.eot *" } # enable eot
/0051 { /type "allow" /glob "* *.jpg *" } # enable jpg
/0052 { /type "allow" /glob "* /services/*" } # enable servlet services
# enable features
/0061 { /type "allow" /glob "POST /content/[.]*.form.html" } # allow POSTs to form selectors under content
/0062 { /type "allow" /glob "* /libs/cq/personalization/*" } # enable personalization
# deny content grabbing
/0081 { /type "deny" /glob "GET *.infinity.json*" }
/0082 { /type "deny" /glob "GET *.tidy.json*" }
/0083 { /type "deny" /glob "GET *.sysview.xml*" }
/0084 { /type "deny" /glob "GET *.docview.json*" }
/0085 { /type "deny" /glob "GET *.docview.xml*" }
/0086 { /type "deny" /glob "GET *.*[0-9].json*" }
/0087 { /type "deny" /glob "GET *.feed.xml*" }
# /0088 { /type "allow" /glob "GET *.1.json*" } # allow one-level json requests
/0089 { /type "allow" /glob "GET /etc/clientcontext/.*/*.json*.*" }
# deny query
/0090 { /type "deny" /glob "* *.query.json*" }
}
# allow propagation of replication posts (should seldomly be used)
/propagateSyndPost "0"
# the cache is used to store requests from the renders for faster delivery
# for a second time.
/cache
{
# the cacheroot must be equal to the document root of the webserver
/docroot "/var/www/html/content/cookbook"
# sets the level upto which files named ".stat" will be created in the
# document root of the webserver. when an activation request for some
# handle is received, only files within the same subtree are affected
# by the invalidation.
/statfileslevel "0"
# caches also authorized data
/allowAuthorized "1"
# the rules define, which pages should be cached. please note that
# - only GET requests are cached
# - only requests with an extension are cached
# - only requests without query parameters ( ? ) are cached
# - only unauthorized pages are cached unless allowUnauthorized is set to 1
/rules
{
/0000
{
# the globbing pattern to be compared against the url
# example: * -> everything
# : /foo/bar.* -> only the /foo/bar documents
# : /foo/bar/* -> all pages below /foo/bar
# : /foo/bar[./]* -> all pages below and /foo/bar itself
# : *.html -> all .html files
/glob "*"
/type "allow"
}
}
# the invalidate section defines those pages which are 'invalidated' after
# any activation. please note that, the activated page itself and all
# related documents are flushed on an modification. for example: if the
# page /foo/bar is activated, all /foo/bar.* files are removed from the
# cache.
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "*.html"
/type "allow"
}
}
}
# the statistics define, how the load should be balanced among the renders
# according to the media-type.
/statistics
{
/categories
{
/html
{
/glob "*.html"
}
/others
{
/glob "*"
}
}
}
}
&#13;
答案 4 :(得分:0)
默认情况下,您不允许使用此过滤器。
# Deny everything first and then allow specific entries
/0001 { /type "deny" /glob "*" }
因此/不允许。如果要允许访问root,则需要通过添加行
来明确允许它/0024 { /type "allow" /glob "* /*" }
答案 5 :(得分:0)
您的调度程序配置看起来很好。要验证调度程序是否正常工作,您只需输入以下URL以查看页面是否显示,然后检查缓存文件夹。
http://localhost:{port如果你没有在apache上使用80)/ content / {sitenode}
假设使用localhost时上述所有内容都有效,它必须是apache配置文件中的配置问题。
检查调度程序模块部分中仔细定义的以下设置
P.S。如果你让它工作,请不要忘记在这里分享一些细节。 :)
答案 6 :(得分:0)
您需要使用mod_rewrite Apache模块将您的请求从'/'重定向到'/content/'/en.html'
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
此官方文档提供了有关如何编写重写规则的良好读物。
除此之外,因为/没有任何扩展名,它表示此请求无法缓存。 我相信除了提到的重定向之外你不需要做任何其他事情,因为en.html有'.html'作为它的扩展名和/ 0047 {/ type“allow”/ glob“* * .html *”}已经提到了在过滤器部分
答案 7 :(得分:0)
我们有两种方法可以解决它。
1,在过滤器部分添加以下规则。
/0001 { /type "allow" /glob "*" }
2,通常在实时项目中我们在/content/xyz.html下有内容,对于这种情况,我们在下面添加规则。
`/0001 { /type "deny" /glob "*" }`
`/0001 { /type "allow" /glob "/content/*" }`
添加重写规则,将URL重定向到/content/xyz.html后的任何内容。
RewriteRule ^ /(。*)/ content / mywebapp / $ 1 [R = 301,L]
根据项目要求继续添加拒绝和允许规则。