在000-default.conf Apache2中更改了DocumentRoot后,服务器上没有权限

时间:2014-01-13 20:06:18

标签: bash ubuntu apache2 permission-denied

我试图让实验室锻炼的步骤休息并遇到问题。 我必须使用bash ubuntu配置apache2。 我用html文件创建了一个文件夹,我想在服务器上共享它。

我从默认行编辑了配置文件/etc/apache2/sites-enabled/000-default.conf的一部分

DocumentRoot /var/www

DocumentRoot /home/chiny/Pulpit/caban/strona

在bash命令之后的更改之前

/etc/init.d/apache2 start

首先,当我在浏览器中访问127.0.0.1时,它说“它有效!”。 但是在我按上述方法更改DocumentRoot并重新启动Apache2后,页面显示:

  

禁   您无权访问此服务器上的/。   Apache / 2.4.6(Ubuntu)服务器在127.0.0.1端口80

有什么问题?

chiny@chiny-HP-Compaq-dc7100-CMT-DX438AV:~$ su
Hasło: 
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 start
 * Starting web server apache2                                                   * 
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# gedit /etc/apache2/sites-enabled/000-default.conf

** (gedit:2112): WARNING **: Could not load Gedit repository: Typelib file for namespace 'GtkSource', version '3.0' not found

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2112): CRITICAL **: log.vala:104: Unable to connect to Zeitgeist: Połączenie jest zamknięte

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2112): CRITICAL **: Unable to connect to Zeitgeist's DataSourceRegistry: Połączenie jest zamknięte

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2112): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 restart * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                         [ OK ]
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# gedit /etc/apache2/sites-enabled/000-default.conf

** (gedit:2328): WARNING **: Could not load Gedit repository: Typelib file for namespace 'GtkSource', version '3.0' not found

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2328): CRITICAL **: log.vala:104: Unable to connect to Zeitgeist: Połączenie jest zamknięte

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2328): CRITICAL **: Unable to connect to Zeitgeist's DataSourceRegistry: Połączenie jest zamknięte

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2328): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 restart * Restarting web server apache2                                                              AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                                       [ OK ]
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# gedit /etc/apache2/sites-enabled/000-default.conf

** (gedit:2443): WARNING **: Could not load Gedit repository: Typelib file for namespace 'GtkSource', version '3.0' not found

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2443): CRITICAL **: log.vala:104: Unable to connect to Zeitgeist: Połączenie jest zamknięte

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)
Error creating proxy: Połączenie jest zamknięte (g-io-error-quark, 18)

(gedit:2443): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2443): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2443): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte

** (gedit:2443): CRITICAL **: Unable to connect to Zeitgeist's DataSourceRegistry: Połączenie jest zamknięte

(gedit:2443): dconf-WARNING **: failed to commit changes to dconf: Połączenie jest zamknięte
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 restart * Restarting web server apache2                                                              AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                                       [ OK ]
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 stop
 * Stopping web server apache2                                                                 * 
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# /etc/init.d/apache2 start
 * Starting web server apache2                                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
 * 
root@chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny# 

Ubuntu 13.10 Apache / 2.4.6

2 个答案:

答案 0 :(得分:0)

在Ubuntu上,apache的用户不是apache,而是www-data! 如果以root用户身份启动apache并不重要,Apache将使用/ etc / apache2 / envvars中定义的用户运行

该用户必须至少拥有 - 读取对指定路径的访问权限 - 必须允许遍历目录(因此必须将x位设置为上面的目录)

微米。

答案 1 :(得分:0)

开始
su -

然后输入你的命令。