apacheの設定で初期にする事もろもろ

httpd.confの初期設定設定とかvhostを加える場合のメモ
1.document root の作成
/var/www/vhost/{new.host.name}/html
/var/www/vhost/{new.host.name}/cgi-bin
の作成
2.logフォルダの作成
/var/log/httpd/{new.host.name}/
3.httpd.confの編集
3-1.初期は
Listen 0.0.0.0:80
User apache
Group apache
ServerAdmin root@localhost
DocumentRoot “/var/www/html”
Options Indexes FollowSymLinks -> Indexesの設定は取っておくのがベター
AllowOverride None -> .htaccess を使う場合は ALLとか
DirectoryIndex index.html index.php index.cgi -> 必要に応じて、優先順位を変更
ErrorLog logs/error_log -> 今後vhostとかふえるのなら、フォルダを別けて管理がベター
CustomLog logs/access_log combined -> combined 形式がいい、場合によって画像とかを取得しない環境変数を追加
あたりを、チェック
3-2. vhostsの追加には
/etc/httpd/conf.d/vhosts.conf に追記するのがベター

ServerAdmin webmaster@ahaut.jp
DocumentRoot /var/www/vhosts/{new.host.name}/html
ServerName {new.host.name}
ServerAlias {host.name}
ErrorLog /var/log/httpd/{new.host.name}/{new.host.name}-error_log
CustomLog /var/log/httpd/{new.host.name}/{new.host.name}-access_log combined

AllowOverride All

ScriptAlias /cgi-bin/ “/var/www/vhosts/{new.host.name}/cgi-bin/”

AllowOverride None
Options FollowSymLinks ExecCGI
Order allow,deny
Allow from all


とか、
4.確認
[root@lot conf]# apachectl -t
[root@lot conf]# apachectl -t -D DUMP_VHOSTS
とかで、設定の確認
5.状況によってはssl.confの設定もわずれずに

2008.05.28

Category: Apache / Tags:

Comments

No Comments

Leave a reply

Name *

Mail *

Website