ひよこメモ

備忘ブログ Ruby, Rails, AWS, html5, css3, javascript, vim,

httpd.confの編集

環境:CentOS


httpd.confは、Apacheの設定ファイル

$ sudo vi /etc/httpd/conf/httpd.conf

でhttpd.confを開く


Vagrant+VirtualBoxでPHP開発環境構築 - Qiita
内で、DocumentRoot, ServerName, は設定すると書かれていたので、そこらへんを調べる


ServerRoot

Apacheをインストールした場所

Listen

特定のIPアドレスやポート番号だけを受け付ける指定。VirtualHostではここの設定のポート範囲内のみ使用できる

デフォルトは80(一般的なHTTP)

DocumentRoot

サーバーのトップ階層

DocumentRoot "/var/www/html"

<Directory 設定項目>~</Directory>

ディレクトリ別の設定ができる

ServerName

サーバ自身が使用するサーバ名とポート番号の指定。BINDで自動取得出来る場合があるが起動時の問題を避けるため指定しておくことが推奨されている。

BIND: 内向きのドメインネームサーバー


とりあえずデフォルト設定のコメントを外す

ServerName www.example.com:80

User/Group

自分で追加して、httpd.confにそれぞれ指定する

$ sudo groupadd httpd
$ sudo useradd -g httpd -d /var/empty/httpd -s /sbin/nologin httpd
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User httpd
Group httpd





参考:httpd.confについて調べたのでまとめたよ - ✘╹◡╹✘