ドメイン名にindex.htmlを設定する方法。 https://www.example.com/ - ユーザをルートディレクトリのindex.htmlに誘導します。Nginxでindex.htmlをルートファイルとして設定するには?
のように私は別のものを試してみた:何が私を助けていない
server {
# some configs
location =/{
index index.html;
fastcgi_index index.html;
}
or
location/{
index index.html;
fastcgi_index index.html;
}
}
。
locationキーワードを持つ他の設定がありますが、私もコメントしています。 server {
句の
その他の "場所" のconfigs:
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ファイルで作成されました。お住まいの地域ブロックで
root /srv/www/ducklington.org/public_html;
'完璧に動作しますindex.html':ちょうど
server {
ブロックに追加します。それはまったく重要ではありません。それはファイルシステム上のファイルの単なる名前です。 –