time 2017/10/17
読むのが面倒な人用まとめ
- SSHで sudo vi /etc/httpd/conf/httpd.conf を叩く
- <Directory “/var/www/html”> を探す
- AllowOverride が None になっているので All にする
- service httpd restart 叩いて再起動
ここから本文
AWSを使ってEC2にWordPressやCakePHPをインストールしたのはいいけど、ページを開こうとすると404になる方。
yumでインストールしたhttpdは、デフォルトのままではmod_rewriteが効かないようになってます。
有効にしない限りずっと404のままになってしまうので、さくっと変更してしまいましょう。
$ sudo vi /etc/httpd/conf/httpd.conf
でhttpd.confを開いてください。
しばらく下にスクロールしていると
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
が書かれていると思います。
その中の
AllowOverride None
を iを押してINSERTモードに変更して、
AllowOverride All
に変更してください。
変更できたら、エスケープキーを押して :wq で保存。
保存出来たら
$ service httpd restart
で再起動します。
これでmod_reweiteが効くようになっているはずです。