LoginSignup
1
0

More than 3 years have passed since last update.

httpd.confのDocumentRootを修正して再起動しても起動出来なくなった。

Posted at

【はじめに】

Amazon EC2 LinuxからApacheのDocumentRootを変更時に
勝手にドツボにハマったので、対処方法を備忘録として残します。

またこれからAWS周りを勉強していく中で
作業中にハマったものをアウトプットとして残していこうと思います。

【開発環境】

Amazon EC2 Linux
Windows 10 HOME
Apache/2.4.43
Tera Term 4.1.105

httpd.confの編集

下記ファイルを編集していきます。

sudo vi /etc/httpd/conf/httpd.conf
httpd.conf
DocumentRoot "/var/www/html"
↓
DocumentRoot "/var/www/html/sample/public”

DocumentRootを変更。

:wq (で保存)

sudo service httpd restart

Apacheを再起動すると。。

Redirecting to /bin/systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe                           " for details.

何やらエラーが出ています。

systemctl status httpd.service

表示されているコマンドを打ってみると・・

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           mqphp-fpm.conf
   Active: failed (Result: exit-code) since Tue 2020-07-07 14:00:14 JST; 13s ago
     Docs: man:httpd.service(8)
  Process: 4107 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 4107 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal systemd[1]: Starting The Apache HTTP Server...
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal httpd[4107]: AH00526: Syntax error on line 121 of /etc/httpd/conf/...nf:
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal httpd[4107]: DocumentRoot '/var/www/html/sample/public\xe2\x80\x9d...ble
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal systemd[1]: httpd.service: main process exited, code=exited, statu...URE
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal systemd[1]: Unit httpd.service entered failed state.
Jul 07 14:00:14 ip-172-31-11-201.ap-northeast-1.compute.internal systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

この中のメッセージを見ていくと、、

 DocumentRoot '/var/www/html/sample/public\xe2\x80\x9d...ble

と何やら変更したDocumentRoot のパスの後ろの部分が文字化け?しています。
まさかと思って、httpd.confをもう一回見てみると

httpd_1.jpg

半角のはずの "(ダブルクォーテーション) が全角で書かれていました。。
んでこれを半角に直して再び再起動すると、、

[ec2-user@ip-172-31-11-201 conf]$ sudo service httpd restart
Redirecting to /bin/systemctl restart httpd.service

エラーなく再起動が完了しました。

1
0
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
1
0