我的AJP代理设置有问题。
SW的版本
Oracle Linux Server 6.5,Apache 2.2.15,Apache Tomcat 7.0.29,tomcat-connectors-1.2.37-src。
预期行为
With slash at the end of URL
http:/@/name.company.local/application/ --> http:/@/name.company.local:8080/application/
It works => OK
Without slash at the end of URL
http:/@/name.company.local/application -> http:/@/name.company.local:8080/application
It does NOT work => K.O.
With path after app name
http:/@/name.company.local/some/path -> http:/@/name.company.local:8080/application/some/path
It does NOT work => K.O.
Apache日志文件(var / log / httpd / name.company.local-error_log)
[Fri Dec 13 10:48:33 2013] [error] [client 10.0.100.26] File does not exist: /var/www/name.company.local/application [Fri Dec 13 10:48:33 2013] [error] [client 10.0.100.26] File does not exist: /var/www/name.company.local/application
AJP代理设置(/etc/httpd/conf.d/ajp.conf)
ProxyRequests Off
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
ProxyPass /application ajp://localhost:8009/application
ProxyPassReverse /application ajp://localhost:8009/application
Apache设置(/ etc / httpd / conf / httpd)
NameVirtualHost *:80
NameVirtualHost *:443
ServerName name.company.local
<VirtualHost *:80>
ServerAdmin webmaster@company.cz
DocumentRoot /var/www/name.company.local
ServerName name.company.local
ServerAlias application
RewriteEngine On
RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 9
RewriteCond %{HTTP_HOST} !.local$
RewriteRule ^/(.*)$ http:/@/name.company.local/$1 [R=301]
RewriteCond %{REQUEST_URI} !^/application/
RewriteRule ^/(.*)$ /application/$1
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{User-Agent}i\"" appspecial
ErrorLog logs/name.company.local-error_log
CustomLog logs/name.company.local-access_log appspecial
</VirtualHost>
关于
Nautil
P.S。 由于Stack Overflow声誉低(我是新手),我无法使用超过2个链接,因此我不得不用http:/ @ /替换有效的HTTP协议前缀。
答案 0 :(得分:0)
我通过更改重写规则解决了在URL 问题末尾没有斜线:
RewriteCond %{REQUEST_URI} !^/application
RewriteRule ^/(.*)$ /application/$1
我还解决了使用app name 之后的路径问题,再次修改了重写规则:
RewriteCond %{REQUEST_URI} !^/application
RewriteRule ^/(.*)$ http://name.company.local/application/$1