当我想转到第一页时,网络服务器Nginx下载索引文件

问题描述

这是我的Nginx配置文件

    ############# DOMAIN domainname.COM ####################
    server {
    server_name  domainname.com;
    rewrite ^(.*) http://www.domainname.com$1 permanent;
    return 301 $scheme://domainname.name$request_uri;
    }
    server {
    # Basic Domain
    server_name www.domainname.com;
    root /home/www/domainname;
    access_log  /var/log/nginx-domainname-access.log;
    error_log   /var/log/nginx-domainname-error.log;
    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
    # rewrite ^(.+)/index.html$ $1 permanent;
    ## REDIRECT domainname.com/index(.php) to domainname.com/
    if ($request_uri ~ ^(.*/)index(?:\.php)?$) {
    return 301 $1;
    }
    # OR USE :
    ## REDIRECT domainname.com/index(.html) to domainname.com/
    if ($request_uri ~ ^(.*/)index(?:\.html)?$) {
    return 301 $1;
    }
    ## REDIRECT domainname.com/index.html to domainname.com/index
    #if ($request_uri ~ ^(.+)\.html$) {
    #    return 301  $1;
    #}
    
    # To remove a slash at the end:
    rewrite ^/(.*)/$ /$1 permanent;
    
    #try_files $uri $uri/index.html =404;
    #try_files $uri $uri/ /index.php?q=$uri&$args;
    error_page 404 /404.html;

    location / {
    # URLs to attempt,including pretty ones.
    try_files   $uri $uri/ /index.php?$query_string;
    index index.html index.php index.py;
    autoindex on;
    }
    # Remove trailing slash to please routing system.
    if (!-d $request_filename) {
        rewrite     ^/(.+)/$ /$1 permanent;
    }
 # cache Media: images,icons,video,audio,HTC
  location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  expires 30d;
  add_header Cache-Control "public";
  }
  # cache.appcache,your document html and data
  location ~* \.(manifest|appcache|html?|xml|json)$ {
  expires -1;
  # access_log logs/static.log; # I don't usually include a static log
  }
  location ~* \.(css|js)$ {
   expires 7d;
  }
  # Feed
  location ~* \.(rss|atom)$ {
  expires 1h;
  add_header Cache-Control "public";
  }                                                  
  }
  
server {
   server_name ~^(www\.)(?<subdomain>.+).domainname.com$ ;
   root /home/www/domainname/$subdomain;
}
server {
   server_name ~^(?<subdomain>.+).domainname.com$ ;
   root /home/www/domainname/$subdomain;
}

在这段代码中,当我想转到第一页时,Nginx下载了索引文件

我想知道为什么会发生

与此同时,我之前收到了403禁止错误消息

我使用的CMS是 WordPress

当然,我想了解“位置/”代码段

我正在等待正确的人

此外,我在子文件夹上安装了 WHMCS ,我想了解可以帮助我毫无问题地访问WHMCS的代码段

多谢并赞赏

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...