web-dev-qa-db-ja.com

Ubuntuアンプ禁止

ローカルホストで自分のサイトにアクセスしようとしていますが、次のようになります。

「禁じられている

このサーバーで/index.htmlにアクセスする権限がありません。ローカルホストポート80 "のApache/2.2.14(Ubuntu)サーバー

私のerror.logは言う:

PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 08:51:51 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 08:51:57 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:51:57 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:52:00 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:52:17 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:54:15 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:54:17 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:55:19 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:55:23 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 08:56:40 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:00:10 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:02:05 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:02:07 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:05:04 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:06:50 2010] [notice] SIGHUP received.  Attempting to restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 09:06:50 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 09:06:57 2010] [crit] [client 127.0.0.1] (13)Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 20 09:08:46 2010] [error] [client 127.0.0.1] (13)Permission denied: file permissions deny server access: /var/www/index.html
[Sun Jun 20 09:08:59 2010] [error] [client 127.0.0.1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Sun Jun 20 09:08:59 2010] [error] [client 127.0.0.1] PHP Fatal error:  Unknown: Failed opening required '/var/www/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
[Sun Jun 20 09:09:47 2010] [error] [client 127.0.0.1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Sun Jun 20 09:09:47 2010] [error] [client 127.0.0.1] PHP Fatal error:  Unknown: Failed opening required '/var/www/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
[Sun Jun 20 09:09:54 2010] [notice] SIGHUP received.  Attempting to restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 09:09:54 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 09:09:55 2010] [error] [client 127.0.0.1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Sun Jun 20 09:09:55 2010] [error] [client 127.0.0.1] PHP Fatal error:  Unknown: Failed opening required '/var/www/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
[Sun Jun 20 09:15:28 2010] [notice] Graceful restart requested, doing restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 09:15:28 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 09:16:51 2010] [notice] Graceful restart requested, doing restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 09:16:51 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 09:16:52 2010] [notice] Graceful restart requested, doing restart
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/Apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Sun Jun 20 09:16:52 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
[Sun Jun 20 09:17:04 2010] [error] [client 127.0.0.1] (13)Permission denied: file permissions deny server access: /var/www/index.html
[Sun Jun 20 09:17:07 2010] [error] [client 127.0.0.1] (13)Permission denied: cannot read directory for multi: /var/www/
[Sun Jun 20 09:17:15 2010] [error] [client 127.0.0.1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Sun Jun 20 09:17:15 2010] [error] [client 127.0.0.1] PHP Fatal error:  Unknown: Failed opening required '/var/www/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
[Sun Jun 20 09:18:38 2010] [error] [client 127.0.0.1] (13)Permission denied: file permissions deny server access: /var/www/index.html

Myusername:myusername/varと/ var/wwwにchownし、711/varと751/var/wwwにchmodedし、/ varで再帰的chowningと/ var/wwwで再帰的chmodingを試しましたが、それでも何も起こりませんでした。

私のサイトにアクセスする方法は?

更新:

varとwwwはchownedwww-data:deltrem、varはchmoded 711、www 751、それでも機能しません:-(

varでの再帰的なchowningは(幸運にも)うまくいかなかったようです

3

/ var chmod 755およびroot:rootのままにする必要があります。/varを変更する理由はありません。

/ var/wwwの場合:

chown -R myusername:www-data /var/www
chmod -R 755 /var/www

ファイルを作成するときは、必ずこの権限を保持してください。そして、Apache2で書き込む必要のあるファイルでは、いくつかのファイルを775に変更する必要があります。

重要:このようにすると、ユーザーアカウントにアクセスできる人なら誰でも、Webサイトのファイルを変更できることに注意してください。

3
Weboide

/ var/wwwは、Apacheユーザーが読み取り可能である必要があります。私のUbuntu9.04では、Apacheはwww-dataとして実行されています。

/ var内のすべての所有権と権限を変更することは良いことではないので、元に戻す必要があります。

1
user9517

Apacheはどのユーザーとして実行されていますか?通常はユーザー「httpd」または「Apache」(iirc)として実行されるため、/ var/wwwをそのユーザーに戻してみてください。 -r/varをchownするべきではありません-そこで読み書きしたいものが他にもあり、おそらくすぐに悲しみを引き起こすでしょう。

0
askvictor