Documentrootの変更ががうまくいきません。
やりたいことindex.htmlファイルの読み込み場所を変更したい
var/www/html/index.html
↓
var/www/wp/index.htmlに変更したい
httpd.confの内容(デフォルト)
DocumentRoot "/var/www/html">
<Directory "/var/www">
<Directory "/var/www/html">
Options Indexes FollowSumLinks
.......
</Directory>
を次のように変更
DocumentRoot "/var/www/wp"
<Directory "/var/www/wp">
apache再起動後(stop&startも実行してみる)
/var/www/html/index.htmlの内容が表示される。
再起動ができていないのかと疑ってみて
systemctl stop httpd
アクセス拒否確認
systemctl start httpd
アクセス可の確認をしてみた。
しかし、変わらずの
html/index.htmlの内容が出て来る。本来ならこれで変更が可能だったと思いますが違いますか???
ーーーーーーーーーーーーーーーーーーーーーー
次ぎも以下のように変更してみた
<Directory "/var/www/wp">
Options Indexes FollowSumLinks
.......
</Directory>
すると
testing 123ページが表示されます
testing 123には
You should add your website content to the directory /var/www/html/
と表記されています.....
つまりパスは/var/www/htmlを読み込んでいるのではないのかと思ったため
httpd.confの他に何があるのかを見てみる
httpd.conf httpd.conf.org httpd.confwp magic
となっている
未だに解決が出来ず......
ーーーーーーーーー質問の修正内容、追加内容ーーーーーーーーーーーーーーーーーーーーーーーー
試してみたことが記入されていなかったり誤字があったことお詫びいたします。
質問修正内容
"の追加
DocumentRoot "/var/www/wp"
ディレクトリ修正
<Directory "/var/www/wp">
その他詳細に記入
試してみたこと確認したこと
1
SElinuxの一時停止
setenforce 0
permissiveに変更
2
SElinuxの停止
vi /etc/selinux/config
SELINUX=enforcing
再起動(reboot)
3
chownで所有者変更
htmlがapache:apacheとなっていたため同じように変更
wp/index.htmlも同じように変更
lsで確認
drwxr-xr-x. 2 apache apache 40 7月 29 08:35 html
drwxr-xr-x. 2 apache apache 24 7月 29 08:35 wp
-rwxrwxrwx. 1 apache apache 43 7月 29 08:35 index.html
4chmod権限変更
取り敢えず777にしてみた
ls結果
-rwxrwxrwx. 1 apache apache 43 7月 29 08:35 index.html
5
chconでセキュリティコンテキスト変更
www/htmlと同じようにしてみた
drwxr-xr-x. apache apache system_u:object_r:httpd_sys_content_t:s0 html
drwxr-xr-x. apache apache system_u:object_r:httpd_sys_content_t:s0 wp
追加事項
デフォルト設定での動作確認OK
29日のログ
error_log-20180729ファイル
[authz_core:error] [pid 2004] [client 192.168.100.167:40694] AH01630: client denied by server configuration: /var/www/html/
これは
welcom.confの
LocationMatch "^/+$">
Options -Indexes
ErrorDocument 403 /.noindex.html
</LocationMatch>
をコメントアウトした時のログだと思われます
31のerrorログ内容(welcom.confコメントアウト後)
e Jul 31 21:21:00.760963 2018] [mpm_prefork:notice] [pid 1918] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Jul 31 21:21:02.727741 2018] [core:notice] [pid 1945] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Tue Jul 31 21:21:02.729456 2018] [suexec:notice] [pid 1945] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jul 31 21:21:02.785191 2018] [auth_digest:notice] [pid 1945] AH01757: generating secret for digest authentication ...
[Tue Jul 31 21:21:02.786424 2018] [lbmethod_heartbeat:notice] [pid 1945] AH02282: No slotmem from mod_heartmonitor
[Tue Jul 31 21:21:02.821366 2018] [mpm_prefork:notice] [pid 1945] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 configured -- resuming normal operations
[Tue Jul 31 21:21:02.821433 2018] [core:notice] [pid 1945] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Jul 31 21:21:08.939653 2018] [authz_core:error] [pid 1946] [client 192.168.100.167:49336] AH01630: client denied by server configuration: /var/www/html/
回答2件
あなたの回答
tips
プレビュー