見出し画像

サーバサイドの構成について02

いつもありがとうございます。

スキマ時間開発のお時間です。よろしくお願いします。


はい。今回は、ゲームで使うPHPの場所についてです。

ConohaさんのVPSを使用する際、WordPressをプリインストールしたので、しょっぱなからApacheが入っています。(わー便利ー)


なので、設定をいじって、ゲーム用のphpをWebから見えるようにします。

Apacheの設定ファイルをいったんバックアップして編集!

画像1


ふむふむ。Rootはデフォルトの /var/www/html が設定されている。

画像2

なん。。。だ。。。と。。。。

画像3

home/kusanagi/xxxx/DocumentRoot/がRootの動きをしているのですけどー?!


これってエイリアス登録してもだめなパターンかしら。。。(Includeしてるファイル全部確認するのめんどくさーい)


シンボリックリンク貼っちゃえ♪(ていっ)

# la
合計 224
drwxrwxrwx  5 kusanagi kusanagi  4096  79 22:34 .
drwxr-xr-x  6 kusanagi kusanagi  4096  622 20:58 ..
-rw-r--r--  1 kusanagi kusanagi   669  325 09:27 .htaccess
-rw-r--r--  1 kusanagi kusanagi   405  26  2020 index.php
-rw-r--r--  1 kusanagi kusanagi 19915  11  2021 license.txt
-rw-r--r--  1 kusanagi kusanagi 10082  520 11:00 readme.html
lrwxrwxrwx  1 root     root         9  79 22:34 we -> /home/we/
-rw-r--r--  1 kusanagi kusanagi  7165  121 10:37 wp-activate.php
drwxr-xr-x  9 kusanagi kusanagi  4096  329 14:58 wp-admin
-rw-r--r--  1 kusanagi kusanagi   351  26  2020 wp-blog-header.php
-rw-r--r--  1 kusanagi kusanagi  2328  217 22:08 wp-comments-post.php
-rw-r--r--  1 kusanagi kusanagi  3873  325 09:27 wp-config-sample.php
drwxr-xr-x  8 kusanagi kusanagi  4096  622 21:01 wp-content
-rw-r--r--  1 kusanagi kusanagi  3939  731  2020 wp-cron.php
drwxr-xr-x 25 kusanagi kusanagi 12288  520 11:00 wp-includes
-rw-r--r--  1 kusanagi kusanagi  2496  26  2020 wp-links-opml.php
-rw-r--r--  1 kusanagi kusanagi  3313  111  2021 wp-load.php
-rw-r--r--  1 kusanagi kusanagi 44994  45 03:34 wp-login.php
-rw-r--r--  1 kusanagi kusanagi  8509  414  2020 wp-mail.php
-rw-r--r--  1 kusanagi kusanagi 21125  22 09:10 wp-settings.php
-rw-r--r--  1 kusanagi kusanagi 31328  128 06:03 wp-signup.php
-rw-r--r--  1 kusanagi kusanagi  4747 109  2020 wp-trackback.php
-rw-r--r--  1 kusanagi kusanagi  3236  69  2020 xmlrpc.php


あ、所有者。。。まぁどうせ777だしいいか。


とりあえずテストしてみましょう。

画像1

さくっとテストファイル配置。


うん。表示できるよね。

画像5


ん。


画像6

httpだ、これー!!(そりゃそうだ)


さてSSL入れましょうかね。ってConohaにまんまのサポートページが。(https://support.conoha.jp/v/hellovps-w-07/)

早速、手順の通りに進めましょう!

# certbot --apache -d XXXXXXX
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apachectl configtest.

AH00526: Syntax error on line 2 of /etc/httpd/conf.d/ssl.conf:
Cannot define multiple Listeners on the same IP:port

The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running apachectl configtest.\n\nAH00526: Syntax error on line 2 of /etc/httpd/conf.d/ssl.conf:\nCannot define multiple Listeners on the same IP:port\n',)

ってあかんのかーい。

ssl.confがコンフリクトしてるのでリネーム。

#mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bk

気を取り直して再実行!

# certbot --apache -d XXXXXXX
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Requesting a certificate for XXXXXXX
Performing the following challenges:
http-01 challenge for XXXXXX
Error while running apachectl graceful.
httpd not running, trying to start

   (中略)

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Error while running apachectl restart.
httpd not running, trying to start

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

画像7

画面が真っ赤だぜ。

Apacheのステータスを確認。

# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
  Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since 水 2021-07-14 00:41:33 JST; 1min 37s ago
 Process: 21189 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

714 00:41:33 160-251-74-103 systemd[1]: Starting The Apache HTTP Server...
714 00:41:33 160-251-74-103 apachectl[21189]: (98)Address already in use: AH00072: make_sock: could not bind to...:]:80
714 00:41:33 160-251-74-103 apachectl[21189]: (98)Address already in use: AH00072: make_sock: could not bind to....0:80
714 00:41:33 160-251-74-103 apachectl[21189]: no listening sockets available, shutting down
714 00:41:33 160-251-74-103 apachectl[21189]: AH00015: Unable to open logs
714 00:41:33 160-251-74-103 systemd[1]: httpd.service: control process exited, code=exited status=1
714 00:41:33 160-251-74-103 systemd[1]: Failed to start The Apache HTTP Server.
714 00:41:33 160-251-74-103 systemd[1]: Unit httpd.service entered failed state.
714 00:41:33 160-251-74-103 systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

Failed to start The Apache HTTP Server.??

画像8

リロードしてもハロワが表示されるけど。

これはWebサーバが他に入っている系か。 DocumentRootよくわからん問題も辻褄があうぞ。

長くなったので、今回はここまで。


次回はプロセスあたりから、実行犯(?)の特定でしょうか。


最後まで読んでいただきありがとうございました。

この記事が気に入ったらサポートをしてみませんか?