LoginSignup
9
9

More than 5 years have passed since last update.

OS X Server.app (Yosemite) を Uninstall して元のYosemite の Apache2 の設定に戻す方法

Last updated at Posted at 2015-07-03

1) まずServer.app起動して、すべてのサービスを「切」にしておく。その後Server.appは終了する。

2) 以下のコマンドでServer.appのWebサービスの設定をdefaultに戻す。

sudo serveradmin command web:command=restoreFactorySettings

 
3) http://localhost/ などをみたりしてWebサーバが上がっていないことや、DHCPだったりDNSだったりがおかしくなっていないか他のマシンでも確認する(Server.appをuninstallして影響がないことを確認)

4) Server.appを削除する。LaunchPadにはいってoption押しっパなしにするとアイコンがぶるぶるしながら肩にバッテンがでるので、バッテンをclick。

5) 以下のファイルがあれば消す。

/Library/Preferences/com.apple.serverd.plist
/Library/Preferences/com.apple.servermgr_*.plist
/Library/Preferences/com.apple.servermgrd.plist
/Library/PrivilegedHelperTools/com.apple.serverd
/Library/Server (ディレクトリごと全部)

6) Mac再起動。

7) /Applications ディレクトリから Server.app がなくなってることを確認して、以下の2つファイル(httpd.confとorg.apache.httpd.plist)の中身を確認して設定を戻す。(書き換える前に、cp -rp したりして backup とっておくこと)

/etc/apache2/httpd.conf

もし同じディレクトリに httpd.conf.pre-update や httpd.conf~previos のような、以前のconfが残っていればそれをhttpd.confに採用してもいいし、サブディレクトリにoriginal/httpd.confがあるので、それを利用する。

この original が Yosemite インストール直後の元本なので、日付などを覚えておくと以下の plist を TimeMachine で復帰させるときの手がかりになる(いつアップデートしたか忘れてたりするので)。

一応サブディレクトリother/やextra/なども確認しておくこと(Yosemiete の Apache2はdefaultでother以下は読込む。phpなどの設定もここにあったりする)。

/System/Library/LaunchDaemons/org.apache.httpd.plist

もし中身が org.apache.httpd でなく com.apple.server になっていたら、org.apache.httpd に直す。org.apache.httpd.plist を書き換えたら

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

して設定を再loadする。(ほかにも設定変更されているかもなので、できれば TimeMachine などでYosemiteインストールしたての時のorg.apache.httpd.plistを復帰させたほうが安心)

8) ほかにも/etc/php.iniが書き換えられているので、/etc/php.ini.defaultなどから元に戻しておく。

9) apache起動

sudo apachectl start

10) http://localhost がみられるかwebブラウザなどで確認(Yosemite defaultのままなら/Library/WebServer/DocumentsがapacheのDocumentRootのはず。「It works!」と表示される。)

11) おつかれさまでした。

参考:

Apache web server won't start. org.apache.httpd.plist: Operation already in progress
https://discussions.apple.com/thread/6602475

Restore Apache2 service after removal of Server.app
http://remonpel.nl/2014/08/restore-apache2-service-after-removal-of-server-app/

9
9
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
9
9