Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

さくらVPSにWordPress環境をつくる その2:独自ドメインをムームードメイン経由で

shuzo-kino.hateblo.jp
の続きです。
今回はムームードメインで取得した独自ドメインを反映させる方法です。

実際のところ

あらかじめ必要なドメインは取得しておいてください。

まずはムームードメイン側の設定。
f:id:shuzo_kino:20180316205400p:plain
標準はムームDNSという奴になってますが、こいつをカスタムドメインに変更
f:id:shuzo_kino:20180316205417p:plain
うまくいくとこんな画面になってるはず
f:id:shuzo_kino:20180316205421p:plain
"http://YOURDOMAIN.com"みたいなURLにしたい場合、以下のように設定します。

f:id:shuzo_kino:20180316205425p:plain

さくらVPS側の設定

Apache2のsite-available用ファイルを開きます

$ sudo vi /etc/apache2/sites-available/010-wordpress.conf

新しい項目ServerNameを作成し、引数を貴方のドメインにします

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port th
at
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerName {{YOURDOMAIN}}
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/wordpress