LoginSignup
0
0

More than 3 years have passed since last update.

Nginx rootディレクティブ

Posted at

rootディレクティブ

rootディレクティブにはドキュメントルートのディレクトリを設定します。httpコンテキスト、serverコンテキスト、locationコンテキスト、location内のifコンテキストに記述できます。上記の例では/usr/share/nginx/htmlがドキュメントルートとなります。

項目 説明
構文 root path;
デフォルト root html;
コンテキスト http, server, location, if in location

path の値には、\$document_root と\$realpath_rootを除いた変数を含めることができます。

ファイルへのパスは単にroot ディレクティブの値にURIを加することで組み立てられます。URIが修正される必要がある場合は、aliasディレクティブが使われるべきです。

そもそもドキュメントルートって?

ドキュメントルートとは、Webサーバ(HTTPサーバ)やFTPサーバが外部に公開するファイルなどが置かれたディレクトリ(フォルダ)。そのディレクトリにあるファイルと、下の階層にあるファイルやディレクトリが公開される。

ドキュメントルート(仮想ルートディレクトリ)とは - IT用語辞典 e-Words

    root /var/www/html;

参考

ngx_http_core_module モジュール 日本語訳
nginx連載4回目: nginxの設定、その2 - バーチャルサーバの設定 - インフラエンジニアway - Powered by HEARTBEATS

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0