問題
サーバを起動、または再起動しようとすると、以下のようなエラーが出る。
$service httpd24-httpd restart
rm: cannot remove `/opt/rh/httpd24/root/var/run/httpd/httpd.pid': Permission denied
rm: cannot remove `/opt/rh/httpd24/root/var/lock/subsys/httpd': Permission denied
rm: cannot remove `/opt/rh/httpd24/root/var/run/httpd/httpd.pid': Permission denied
Starting httpd: AH00526: Syntax error on line 31 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf:
Invalid command '/etc/httpd', perhaps misspelled or defined by a module not included in the server configuration
[FAILED]
※環境はcentos65で、httpd24は以下のリポジトリのものを使用。
https://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
解決方法
sudoのつけ忘れ。エラーメッセージから分かりにくい。
$ sudo service httpd24-httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]