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,chmoded到711 / var和751 / var / www,我试着对/ var / www上的/ var和recursionchmoding进行recursionchowning,但仍然没有任何结果。

如何访问我的网站?

更新:

变种和万维网变得万维网www-data:deltrem,变种是变色711,www 751,它仍然无法正常工作:-(

var(幸运地)recursionchowning似乎没有工作

/ var应该保持chmod 755和root:root。 没有理由改变/ var。

对于/ var / www试试:

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

请确保您在创build文件时保留此权限。 而你将probaby需要更改一些文件到775那些需要由Apache2写的。

重要提示:请注意,通过这种方式,任何有权访问您的用户帐户的人都可以修改网站文件。

/ var / www需要apache用户可读。 在我的Ubuntu 9.04上,apache作为www-data运行。

在/ var中更改所有权和权限并不是一件好事,你应该把它恢复原样。

什么用户是Apache运行? 它通常以用户'httpd'或'apache'(iirc)运行,因此请尝试将/ var / www chowning回该用户。 你不应该chown -r / var – 会有其他的东西想要读和写在那里,很可能会很快导致你的悲伤。