【发布时间】:2011-10-02 09:34:13
【问题描述】:
我不是一个完整的初学者,很抱歉发布了一个模棱两可的问题,这个问题已经以其他稍微不同的形式发布了这么多。无论如何我得到这个错误:
Forbidden
You don't have permission to access / on this server.
Apache/2.2.14 (Ubuntu) Server at gookie.localhost Port 80
我有 apache2 代理一个 tomcat6。以下是详细信息:
- tomcat 安装在 /home/ae1/lib/java/apache-tomcat-6.0.29
- ln -s /home/ae1/lib/java/apache-tomcat-6.0.29 /var/www/tomcat6
- http.conf:
<Directory "/var/www/tomcat6/webapps/springapp">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
- /etc/hosts 有这个条目:
127.0.0.1 localhost gookie.localhost - /etc/apache2/sites-available/gookie.localhost.conf
<VirtualHost *:80 >
ServerName gookie.localhost
DocumentRoot /var/www/tomcat6/webapps/springapp
DirectoryIndex index.jsp index.html index.htm index.php
ProxyPass / http://localhost:8080/springapp
ProxyPassReverse / http://localhost:8080/springapp
</VirtualHost>
<Directory "/home/www/tomcat6/webapps/springapp">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
- /var/www/tomcat6/conf/server.xml 文件有:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
proxyName="gookie.localhost"
/>
我在server.xml 中有proxyPort="80",但仍然没有运气。
对此有什么想法吗?
【问题讨论】:
-
还有更多见解:localhost:8080 工作正常,并且 localhost:8080/springapp 重定向到 gookie.localhost/springapp 并给出相同的 403 错误。没有这个:
ProxyPass / http://localhost:8080/springapp ProxyPassReverse / http://localhost:8080/springapp我让 apache 显示 index.jsp 没有在 gookie.localhost 解析 标记,但是一旦我添加代理指令它就会中断。 -
好的解决方案是更改此文件:/etc/apache2/mods-enabled/proxy.conf 以显示
<IfModule mod_proxy.c> ProxyRequests Off <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> -
请把它放在一个答案中,没有任何换行符真的很混乱