问题描述
这是我的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 (将#修改为@)