Search code examples
bashubuntuapache2permission-denied

No permission on server after changed DocumentRoot in 000-default.conf Apache2


I'm trying to fallow the steps of the laboratory exercise and encounter a problems. i have to configure apache2 using bash ubuntu. I created a folder with the html file and I want to share it on a server.

i edited the part of the config file /etc/apache2/sites-enabled/000-default.conf from default line

DocumentRoot /var/www

to

DocumentRoot /home/chiny/Pulpit/caban/strona

Before that change after bash command

/etc/init.d/apache2 start

At first, when I visited 127.0.0.1 in a browser, it said "It works!". But after I changed DocumentRoot as above and restarted Apache2 now the page says:

Forbidden You don't have permission to access / on this server. Apache/2.4.6 (Ubuntu) Server at 127.0.0.1 Port 80

What is wrong?

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


Solution

  • on Ubuntu the user for the apache is not apache, but www-data! It doesn't matter if you start the apache as root user, the Apache will run with the user defined in /etc/apache2/envvars

    That user must have at least - read access to the path specified - must be allowed to traverse into the directory (herefor the x Bit must be set to the directories above)

    M.