0

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

janos
  • 120,954
  • 29
  • 226
  • 236
Sruj
  • 1,177
  • 2
  • 18
  • 38
  • Do you have any files in `/home/chiny/Pulpit/caban/strona`? Do you have a file called `index.html`? If not, put there one. – janos Jan 13 '14 at 20:44
  • yes i have html file in there. – Sruj Jan 13 '14 at 20:56
  • Then probably the `apache` user doesn't have permission to the directory `/home/chiny/Pulpit/caban/strona` – janos Jan 13 '14 at 20:58
  • i have created that directory, also i configured and started apache as a root. (Also im newbie in linux, so for sure im missing something) – Sruj Jan 13 '14 at 21:01
  • Does this command work: `sudo -u apache ls -l /home/chiny/Pulpit/caban/strona` – janos Jan 13 '14 at 21:05
  • Too bad i have no way to check that now. Im doing all this Apache things on second computer which i do not have access tonight already. I will check it tomorrow. thanks for what you did today. – Sruj Jan 13 '14 at 21:12
  • I believe the apache user has to have read access to all of `/`, `/home`, `/home/chiny`, `/home/chiny/Pulpit`, `/home/chiny/Pulpit/caban`, and `/home/chiny/Pulpit/caban/strona` – glenn jackman Jan 13 '14 at 21:26
  • 'has to have' in this context mean: i have that access or should I take care to have it? – Sruj Jan 13 '14 at 21:59
  • You'll want to find out what the apache user is in the main apache conf first. It may not be 'apache', it could be www-data or the like. You'll see something like: User apache Group apache Since you said ubuntu, it might be setup in a file called /etc/apache2/envvars which would look something like: export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data Regardless, you need to make sure /var/www is at least grop owned by the group apache is set to run as and that the directory has execute perms. index.html needs to have read for group and group ownership of apache group as well – Kevin Jan 13 '14 at 23:51
  • after this command :sudo -u apache ls -l /home/chiny/Pulpit/caban/strona sudo: unknow user: apache sudo: no way to install policy (i translate it from polish lang) – Sruj Jan 14 '14 at 06:55

2 Answers2

0

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.

0

Start with

su -

then enter your command.

Opal
  • 81,889
  • 28
  • 189
  • 210