CodeIgniter 的新副本可通过 LAN 运行,但通过 WAN 时会出现 403 错误
我正在启动一个新的 CodeIgniter 项目,因此我获取了 2.1 版的新副本,并将其解压到我的本地 Apache 根目录。我设置了 config.php 并通过计算机的 LAN IP 从本地主机和另一台计算机测试了该站点,并且它按预期工作。
我还让路由器将 WAN 端口 443 转发到服务器计算机上的端口 80,以便我可以从学校访问我的 Apache 服务器(通过 wan_ip:443)。这通常工作正常,但当我尝试访问我的新 CodeIgniter 副本时,我收到 403 Forbidden 页面。
我仍然可以通过 WAN 访问 Apache 服务器上的所有其他子文件夹,包括其他较旧的 CodeIgniter 项目。
新副本的根目录中没有 .htaccess 文件。我递归地尝试了 chmod-ing 755 和 777,但没有任何变化。
有人知道这可能是什么原因造成的吗?我做过很多 CodeIgniter 项目,但从来没有遇到过这个问题。
I'm starting a new CodeIgniter project, so I grabbed a fresh copy of version 2.1, and unarchived it to my local Apache root. I set up config.php and tested the site from localhost and another machine via the computer's LAN IP, and it worked as expected.
I also have my router forward WAN port 443 to port 80 on my server machine, so that I can access my Apache server from school (via wan_ip:443). This usually works fine, but when I try access my new CodeIgniter copy, I get a 403 Forbidden page.
I can still access all other sub-folders on my Apache server via WAN, including other, older, CodeIgniter projects.
There is no .htaccess file in the root of the fresh copy. I tried chmod-ing 755 and 777 recursively, but with no change.
Anybody have any idea what could be causing this? I've done quite a few CodeIgniter projects, and I've never had this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会看一下 apache 配置,也许有与 ip 有关的东西。
另请检查您的 codeigniter 配置。也许它正在做一些路由。
如果 apache 可以正常工作,请尝试用简单的 index.html 替换您的项目。
检查你的项目本身是否做了一些重定向或类似的事情......
I would have a look at the apache config maybe there is something related to the ip.
Also check your codeigniter config. Maybe it is doing some routing.
Try to replace your project with a simple index.html if that works apache is fine.
Check if your project itself does some redirect or something like this...
原来是 Apache 的问题。我创建了一个 .htaccess 文件并向其中添加了“Allow from all”,现在它可以工作了。我不知道为什么我需要这样做,因为我可以通过 WAN 访问所有其他 Apache 目录,但它确实有效。
Turns out it was an Apache issue. I created an .htaccess file and added "Allow from all" to it, and now it works. I'm not sure why I needed to do that since I could access all my other Apache directories over WAN just fine, but it worked.