LoginSignup
7
3

More than 5 years have passed since last update.

さくらVPS サブドメインを設定

Posted at

下記にアクセス。

https://secure.sakura.ad.jp/menu/dns/

ゾーン設定をクリック。エントリの追加と変更のテーブルに下記を入力。

タイトル 内容
エントリ名 hoge.xxx.com
種別 CNAME
@
DNSチェック する
TTLの指定 チェックしない

新規登録ボタンをクリック。

nginx.confを開く。

$ sudo vim /etc/nginx/nginx.conf

ポートは80番、サーバネームには設定したサブドメインを、ドキュメントルートは/var/www/html/hogeに設定。

server {
    listen       80;
    server_name  hoge.xxx.com;
    root         /var/www/html/hoge/;
}  

設定ファイルの構文チェック。

$ sudo nginx -t

問題なければ、nginxを再起動。

$ systemctl restart nginx

/var/www/html/hoge/index.htmlを配置し、hoge.xxx.comにアクセスし、ページが表示されれば完了。

7
3
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
7
3