サーバサイドの構成について02
いつもありがとうございます。
スキマ時間開発のお時間です。よろしくお願いします。
はい。今回は、ゲームで使うPHPの場所についてです。
ConohaさんのVPSを使用する際、WordPressをプリインストールしたので、しょっぱなからApacheが入っています。(わー便利ー)
なので、設定をいじって、ゲーム用のphpをWebから見えるようにします。
Apacheの設定ファイルをいったんバックアップして編集!
ふむふむ。Rootはデフォルトの /var/www/html が設定されている。
なん。。。だ。。。と。。。。
home/kusanagi/xxxx/DocumentRoot/がRootの動きをしているのですけどー?!
これってエイリアス登録してもだめなパターンかしら。。。(Includeしてるファイル全部確認するのめんどくさーい)
シンボリックリンク貼っちゃえ♪(ていっ)
# la
合計 224
drwxrwxrwx 5 kusanagi kusanagi 4096 7月 9 22:34 .
drwxr-xr-x 6 kusanagi kusanagi 4096 6月 22 20:58 ..
-rw-r--r-- 1 kusanagi kusanagi 669 3月 25 09:27 .htaccess
-rw-r--r-- 1 kusanagi kusanagi 405 2月 6 2020 index.php
-rw-r--r-- 1 kusanagi kusanagi 19915 1月 1 2021 license.txt
-rw-r--r-- 1 kusanagi kusanagi 10082 5月 20 11:00 readme.html
lrwxrwxrwx 1 root root 9 7月 9 22:34 we -> /home/we/
-rw-r--r-- 1 kusanagi kusanagi 7165 1月 21 10:37 wp-activate.php
drwxr-xr-x 9 kusanagi kusanagi 4096 3月 29 14:58 wp-admin
-rw-r--r-- 1 kusanagi kusanagi 351 2月 6 2020 wp-blog-header.php
-rw-r--r-- 1 kusanagi kusanagi 2328 2月 17 22:08 wp-comments-post.php
-rw-r--r-- 1 kusanagi kusanagi 3873 3月 25 09:27 wp-config-sample.php
drwxr-xr-x 8 kusanagi kusanagi 4096 6月 22 21:01 wp-content
-rw-r--r-- 1 kusanagi kusanagi 3939 7月 31 2020 wp-cron.php
drwxr-xr-x 25 kusanagi kusanagi 12288 5月 20 11:00 wp-includes
-rw-r--r-- 1 kusanagi kusanagi 2496 2月 6 2020 wp-links-opml.php
-rw-r--r-- 1 kusanagi kusanagi 3313 1月 11 2021 wp-load.php
-rw-r--r-- 1 kusanagi kusanagi 44994 4月 5 03:34 wp-login.php
-rw-r--r-- 1 kusanagi kusanagi 8509 4月 14 2020 wp-mail.php
-rw-r--r-- 1 kusanagi kusanagi 21125 2月 2 09:10 wp-settings.php
-rw-r--r-- 1 kusanagi kusanagi 31328 1月 28 06:03 wp-signup.php
-rw-r--r-- 1 kusanagi kusanagi 4747 10月 9 2020 wp-trackback.php
-rw-r--r-- 1 kusanagi kusanagi 3236 6月 9 2020 xmlrpc.php
あ、所有者。。。まぁどうせ777だしいいか。
とりあえずテストしてみましょう。
さくっとテストファイル配置。
うん。表示できるよね。
ん。
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
画面が真っ赤だぜ。
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)
7月 14 00:41:33 160-251-74-103 systemd[1]: Starting The Apache HTTP Server...
7月 14 00:41:33 160-251-74-103 apachectl[21189]: (98)Address already in use: AH00072: make_sock: could not bind to...:]:80
7月 14 00:41:33 160-251-74-103 apachectl[21189]: (98)Address already in use: AH00072: make_sock: could not bind to....0:80
7月 14 00:41:33 160-251-74-103 apachectl[21189]: no listening sockets available, shutting down
7月 14 00:41:33 160-251-74-103 apachectl[21189]: AH00015: Unable to open logs
7月 14 00:41:33 160-251-74-103 systemd[1]: httpd.service: control process exited, code=exited status=1
7月 14 00:41:33 160-251-74-103 systemd[1]: Failed to start The Apache HTTP Server.
7月 14 00:41:33 160-251-74-103 systemd[1]: Unit httpd.service entered failed state.
7月 14 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.??
リロードしてもハロワが表示されるけど。
これはWebサーバが他に入っている系か。 DocumentRootよくわからん問題も辻褄があうぞ。
長くなったので、今回はここまで。
次回はプロセスあたりから、実行犯(?)の特定でしょうか。
最後まで読んでいただきありがとうございました。
この記事が気に入ったらサポートをしてみませんか?