Centos6.5にnginxをインストール、confファイルの書き方を見てみる
インストールはこんな感じで
#![Remi リポジトリ導入] -------------------- yum -y install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/remi.repo ################################################################################ # # nginxのリポジトリを設定インストール # ################################################################################ touch /etc/yum.repos.d/nginx.repo vi /etc/yum.repos.d/nginx.repo #↓----------------------------------------------------------------------------- [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 #-----------------------------------------------------------------------------↑ #yumのパッケージを最新にアップデート yum -y update #インストール yum -y install nginx #起動(再起動コマンドだけど) service nginx restart #自動起動・確認 chkconfig –add nginx chkconfig nginx on chkconfig --list nginx #バージョン確認(nginx/1.6.1でした) nginx -v
設定ファイルを見てみよう
設定ファイルはここみたい
cat /etc/nginx/nginx.conf
32行目にこんな記述があった。
include /etc/nginx/conf.d/*.conf;
つまり/etc/nginx/conf.d/以下のファイルを読み込んでいるということですね。
で
cd /etc/nginx/conf.d/ してllで見ると
default.conf example_ssl.conf
ってのがいました。
vi default.confでもう編集する気満々で見てみます。
#8行目にこんなのがいました location / { root /usr/share/nginx/html; index index.html index.htm; }
↓
#root ・・・ DocumentRootっぽい!ということで↓みたいにしました。 location / { root /var/www/html; index index.html index.htm index.php index.cgi index.rb index.pl; }
DocumentRootが無事apacheのデフォルトと同じになりました。