如何为域名设置index.html例如 [https://www.example.com/]-引导用户进入根目录中的index.html。
我尝试了不同的事情,例如:
server {
# some configs
location = / {
index index.html;
fastcgi_index index.html;
}
or
location / {
index index.html;
fastcgi_index index.html;
}
}
没有任何帮助。
还有一些其他带有location关键字的配置,尽管我也对它们进行了评论。
server {子句中的其他“位置”配置:
location ~ .*(css|htc|js|bmp|jp?g|gif|ico|cur|png|swf|htm?|html)$ {
access_log off;
root $www_root;
}
location ~ \.php$
{
include /etc/nginx/fastcgi_params;
index index.html;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME $www_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
# Директива определяет что ответы FastCGI-сервера с кодом больше или равные 400
# перенаправлять на обработку nginx'у с помощью директивы error_page
fastcgi_intercept_errors on;
break;
}
location ~ /\.ht {
deny all;
}
他们所有人都没有评论和评论,但没有任何帮助。
PS版本是在/etc/nginx/sites-enabled/domainname.com文件中制作的。