Come impostare index.html per il nome del dominio, ad es. https://www.example.com/ - porta l'utente a index.html nella directory principale.Come impostare index.html come file root in Nginx?
Ho provato cose diverse, come:
server {
# some configs
location =/{
index index.html;
fastcgi_index index.html;
}
or
location/{
index index.html;
fastcgi_index index.html;
}
}
Niente mi ha aiutato.
Ci sono alcune altre configurazioni con la parola chiave posizione, anche se avevo commentato loro.
Altri "Location" configurazioni nella clausola 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;
}
Tutti loro sono state commentate e commentate, ma non serviva a niente.
Le edizioni PS sono state apportate nel file /etc/nginx/sites-enabled/domainname.com.
per me 'index.html' funziona perfettamente. Non ha alcuna importanza, è solo un nome di un file sul filesystem. –