&bold(){nginx バーチャルホスト} ドメインごとに基本的なレイアウトを作成していきます。 demo一般ユーザーでdomain1.comというドメインを運営する場合です。 ディレクトリを作成します。 mkdir /home/demo/public_html サブフォルダを作成します。 mkdir -p /home/demo/public_html/domain1.com/{public,private,log,backup} トップのindex.htmlを作成してします。 vi /home/demo/public_html/domain1.com/public/index.html index.htmlの内容 <html> <head> <title>domain1.com</title> </head> <body> <h1>domain1.com</h1> </body> </html> バーチャルホストの設定ファイルを作成します。 sudo vi /etc/nginx/sites-available/domain1.com /etc/nginx/sites-available/domain1.comの内容 server { listen 80; server_name www.domain1.com; access_log /home/demo/public_html/domain1.com/log/access.log; error_log /home/demo/public_html/domain1.com/log/error.log; location / { root /home/demo/public_html/domain1.com/public/; index index.html; } } server { listen 80; server_name domain1.com; access_log /home/demo/public_html/domain1.com/log/access.log; error_log /home/demo/public_html/domain1.com/log/error.log; location / { root /home/demo/public_html/domain1.com/public/; index index.html; } }
下から選んでください: