尽管我进行了配置,Nginx 仍错误地重定向我

尽管我进行了配置,Nginx 仍错误地重定向我

好吧,我在这家新公司工作,无法从他们的老开发人员那里获得有关 nginx 配置的任何知识。一切都很好,直到我开始遇到这个非常令人沮丧的问题。有一个这样的目录:site.com/(包含一个 dev 文件夹和一个 public 文件夹)/(网站的精确副本)我一次又一次地尝试从 Web 访问 dev 部分。我尝试了这样的 dev. 配置

    server {
    listen   80;
    listen [::]:80;

    server_name  dev.site.net;
    # note that these lines are originally from the "location /" block
    root   directory/site.net/dev;
    index index.php index.html index.htm;

    ssl off;
} 

像这样:尝试使用另一个空域来引用路径。

server {
    listen   80;
    listen [::]:80;

    server_name  testDomain.com www.testDomain.com;
    # note that these lines are originally from the "location /" block
    root   /directory/site.net/dev;
    index index.php index.html index.htm;

    ssl off;

if($redirect_https = 1){
    return 301 http://www.getmoreforit.com$request_uri; 
}

我确信域名指向了 DNS 中的正确位置。但是,这两种方法都只能产生两种结果之一。要么它会将我带到一个带有用户名和密码提示的屏幕,为此我尝试了剩下的所有密码和用户名。但都不起作用。要么它会将我重定向到服务器上完全不同的站点,尽管此配置文件中的配置相当清晰。我很困惑。请帮忙

相关内容