【问题标题】:stop nginx redirecting to /public folder停止 nginx 重定向到 /public 文件夹
【发布时间】:2015-03-09 21:27:43
【问题描述】:

我在192.168.33.10 托管一个VM,并将我的webroot 配置为/home/vagrant/www

我在其中放置了一个index.php。导航到192.168.33.10/index.php 提供文件,但导航到192.168.33.10 总是重定向到192.168.33.10/public

如何禁用此公共重定向?

编辑 - 包括“/etc/nginx/sites-enabled/default”:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/vagrant/www;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

【问题讨论】:

  • index.php所在目录下是否有.htaccess文件?这可能会导致重定向?
  • 不,这是全新安装 - 未安装或从未使用过 apache
  • 检查 nginx.conf
  • 我检查了 nginx.conf - 根本没有提到“公共”这个词。这是使用 apt-get 全新安装的 nginx。原始 index.html 是从 192.168.33.10/public 提供的,即使它不存在
  • 对整个网站进行系统搜索以供公众使用。它可能隐藏在您可以俯瞰的某个地方。

标签: php nginx debian


【解决方案1】:

好吧,感觉很愚蠢。 Chrome 的浏览器一直自动补全到192.168.33.10/public! - 必须清除缓存,一切都很好。不确定如何在 Chrome 中防止这种行为

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-20
    • 2016-11-07
    • 2014-09-02
    • 2017-08-02
    相关资源
    最近更新 更多