UJP - 技術情報

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

     

Apacheを起動したり停止したりする

Apacheを起動したり停止したりする


0.改訂履歴

  • 2002.08.25 新規作成

1.はじめに

 このドキュメントでは,MacOS X 10.1.5で,Apacheを起動する手順を説明する.

 なお,MacOS Xの場合,2つの方法があり,GUIで起動する場合とTerminalで起動する方法がある.

 GUIで起動する方法以外は,一般的なApacheのコントロール方法である.

2.GUIで起動する

  • アップルメニューから[システム環境設定]を開く.

  • [共有]をクリックする.

  • [Web共有してません]の下の[開始]ボタンを押下する.

  • 開始したら,Webブラウザを起動する.
  • http://localhost/にアクセスしてみる.
  • 次のように表示されたらOK .

  • 終了時には,[システム環境設定]→[共有]→[停止]を行う.

3.Terminalで起動する

3.1.apachectlを確認する

  • apachectlがあるか確認する.
[localhost:~] shinnai% which apachectl
/usr/sbin/apachectl
[localhost:~] shinnai% 
  • apachectlってどんなファイルか確認する.
[pbg4-667:~] shinnai% file /usr/sbin/apachectl
/usr/sbin/apachectl: Bourne shell script text
[pbg4-667:~] shinnai%
  • シェルスクリプトでした.
  • apachectlを実行してみる.
  • オプションに,helpを付けて,使用方法を確認する.
[pbg4-667:~] shinnai% apachectl help
usage: /usr/sbin/apachectl (start|stop|restart|fullstatus|status|graceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if 
             not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen

[pbg4-667:~] shinnai% 

3.2.apacheを起動する

  • apachectlを使って,apacheを起動する.
  • rootユーザで実行するので,sudoコマンドを使用する.
    • rootユーザじゃないと,HTTPが使う80番ポートを利用できない.
[pbg4-667:~] shinnai% sudo apachectl start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/shinnai.conf
 Processing config file: /private/etc/httpd/users/sybase.conf
[Sat Aug 24 03:27:46 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
/usr/sbin/apachectl start: httpd started
[pbg4-667:~] shinnai% 
  • ワーニングがでているが,これはサーバ名がドメインに登録されてないとかいう事なので無視する.
  • Processing config fileってので,何が読み込まれたのか確認する.
[pbg4-667:~] shinnai% cat /private/etc/httpd/users/shinnai.conf
<Directory "/Users/shinnai/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
[pbg4-667:~] shinnai% 
  • アクセスコントロールでした.
  • Webブラウザで,http://localhost/を表示してみる.

  • 表示できた.

3.3.apacheを停止する

  • apacheのプロセスが起動しているか確認する.
[pbg4-667:~] shinnai% ps -auxOf | grep http
root     2406   0.0  0.1     2616   1176  ??  Ss     0:00.03       4 /usr/sbin/httpd
www      2416   0.0  0.0     2616    328  ??  S      0:00.00     104 /usr/sbin/httpd
shinnai  2420   0.0  0.0     1368    216 std  R+     0:00.00    4006 grep http
[pbg4-667:~] shinnai%
  • httpdというのがapacheである.
  • 停止する場合も,apachectlを使う.
[pbg4-667:~] shinnai% sudo apachectl stop
/usr/sbin/apachectl stop: httpd stopped
[pbg4-667:~] shinnai% ps -auxOf | grep http
shinnai  2424   0.0  0.0     1368    216 std  R+     0:00.00    4006 grep http
[pbg4-667:~] shinnai% 
  • プロセスが停止している事が分かる.


広告スペース
Google