[[さくらのVPS]]

#contents

*Apacheとは? [#pd9df5ec]
- Webサーバソフトとして、標準的な「Apache(アパッチ)」をインストールしてみます。
- Apache以外だと、「nginx(エンジンエックス)」も人気が出てきているようです。

(参考)
http://ja.wikipedia.org/wiki/Apache_HTTP_Server
http://ja.wikipedia.org/wiki/Nginx

* Apacheのインストール [#v206e489]
(参考)
http://akibe.com/2010/09/centos-setup-4-apache/

- yumでApacheをインストール

 # yum -y install httpd
 # httpd -v
 # /etc/rc.d/init.d/httpd start
 # chkconfig httpd on
 # chkconfig --list httpd
↓

 httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

** Apache設定ファイルの編集 [#k78e4513]
- 元ファイルをコピーしてから vi で開きます。

 # cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
 # vi /etc/httpd/conf/httpd.conf

(以下の表記で、「--」は削除する行、「++」は追記する行を意味しています。つまり、「--」と「++」の二つ合わせて、書き換える部分を示しています。)

+ レスポンスヘッダにOSのバージョンを表示させない
 -- ServerTokens OS
 ++ ServerTokens Prod
+ KeepAliveを有効にする
 -- KeepAlive Off
 ++ KeepAlive On
+ サーバー管理者の指定
 -- ServerAdmin root@localhost
 ++ ServerAdmin sagasite.info@gmail.com
 ++ ServerAdmin info@mydomain.com
+ サーバー名の指定
 -- ServerName new.host.name:80
 ++ ServerName sagasite.info:80
 ++ ServerName mydomain.com:80
+ DocumentRootの確認
 DocumentRoot "/var/www/html"
+ ディレクトリ内のファイル表示を無効化
 <Directory "/var/www/html">
 :
 -- Options Indexes FollowSymLinks
 ++ Options -Indexes FollowSymLinks → mod_rewriteを使う場合はダメ?
 :
 </Directory>
+ indexの設定
 -- DirectoryIndex index.html index.html.var
 ++ DirectoryIndex index.html index.php index.cgi index.html.var

**Apache設定のチューンナップ [#ocb58af5]
(参考)
http://d.hatena.ne.jp/koujirou6218/20101129/
=必要に応じて設定値を変更する。

* Apache再起動で設定変更を反映 [#j54d8a92]
 # /etc/rc.d/init.d/httpd restart

* DocumentRootの所有者変更 [#aaf8d976]
Apacheで公開ディレクトリーとなっている「/var/www/html」 というディレクトリのユーザーとグループを「sakura」に変更します。
(この設定メモでは、作業用ユーザーのアカウント名を「sakura」として説明しています。)

 # chown sakura:sakura /var/www/html

これで、WinSCPやFFFTPで、コンテンツのファイルやフォルダをアップロードできるようになるはず。
=公開ディレクトリーの所有者を変更していないと、「アクセス権限がない」というようなエラーが出ます。

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS