Apache2 configuration

Asked by T. S. Ferreira

I activated apache2 under my Ubuntu, and it shows the Placeholder page when I give it the URL http://localhost.

However it says "The requested URL /~myusername was not found on this server." when I try http://localhost/~myusername.

I tried to configure it comparing apache2.conf and associated files with my httpd.conf I used under Fedora, but it did not work.

Any hints?

-- tsf

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
T. S. Ferreira
Solved:
Last query:
Last reply:
Revision history for this message
Ralph Janke (txwikinger) said :
#1

Thanks for the question.

I am not sure, what you are trying to do. Do you want to configure the usage of public homepages?

Thanks

Revision history for this message
T. S. Ferreira (tsferreira) said :
#2

Yes, I have a directory /home/myusername/public_html, with my html
files and I would like to display them.

-- tsf

On 5/19/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Needs information
>
> Ralph Janke requested for more information:
> Thanks for the question.
>
> I am not sure, what you are trying to do. Do you want to configure the
> usage of public homepages?
>
> Thanks
>
> _______________________________________________________________________
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Ralph Janke (txwikinger) said :
#3

You should be able to configure this by inserting

USERDIR public_html

in the httpd.conf file in /etc/apache2. Don't forget to restart the apache daemon after the change!

See also http://httpd.apache.org/docs/2.2/mod/mod_userdir.html#userdir and http://httpd.apache.org/docs/2.2/howto/public_html.html

Revision history for this message
T. S. Ferreira (tsferreira) said :
#4

Under my installation there is a apache2.conf file which "Includes"
files from the subdirectory "mods-enabled". This subdirectory contains
a file clalled "userdir.conf" whose contents is:

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        </Directory>
</IfModule>

Thus the information you suggest seems to be there already!

-- tsf

On 5/19/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Answered
>
> Ralph Janke proposed the following answer:
> You should be able to configure this by inserting
>
> USERDIR public_html
>
> in the httpd.conf file in /etc/apache2. Don't forget to restart the
> apache daemon after the change!
>
> See also http://httpd.apache.org/docs/2.2/mod/mod_userdir.html#userdir
> and http://httpd.apache.org/docs/2.2/howto/public_html.html
>
> _______________________________________________________________________
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.beta.launchpad.net/ubuntu/+question/6866/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Ralph Janke (txwikinger) said :
#5

That look fine. In my system it also works without problems. Have you create the directory public_html in your home folder ?

Revision history for this message
T. S. Ferreira (tsferreira) said :
#6

Yes, I did!

-- tsf

On 5/19/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Answered
>
> Ralph Janke proposed the following answer:
> That look fine. In my system it also works without problems. Have you
> create the directory public_html in your home folder ?
>
> _______________________________________________________________________
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.beta.launchpad.net/ubuntu/+question/6866/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Ralph Janke (txwikinger) said :
#7

Could you please look in the folder /var/log/apache2/. There should be an access.log and an error.log file. Look in there (or paste them here, or try to access it again and past the last part of it here).

The information should give us a better idea what might be wrong.

Revision history for this message
T. S. Ferreira (tsferreira) said :
#8

In access.log the last line is:

127.0.0.1 - - [20/May/2007:10:13:13 -0300] "GET /~myusername/
HTTP/1.1" 404 290 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)"

and in error.log it is:

[Sun May 20 10:13:13 2007] [error] [client 127.0.0.1] File does not
exist: /var/www/~myusername

It seems that Apache2 ignores user directories?!

-- tsf

On 5/20/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Needs information
>
> Ralph Janke requested for more information:
> Could you please look in the folder /var/log/apache2/. There should be
> an access.log and an error.log file. Look in there (or paste them here,
> or try to access it again and past the last part of it here).
>
> The information should give us a better idea what might be wrong.
>
> _______________________________________________________________________
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Ralph Janke (txwikinger) said :
#9

Maybe you don't have mod_userdir installed ? It is usually installed through apache2-common and is in ther directory /usr/lib/apache2/modules/mod_userdir.so

Revision history for this message
T. S. Ferreira (tsferreira) said :
#10

I checked: it is there! I checked again all my permissions, and they are OK.

-- tsf

On 5/20/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Answered
>
> Ralph Janke proposed the following answer:
> Maybe you don't have mod_userdir installed ? It is usually installed
> through apache2-common and is in ther directory
> /usr/lib/apache2/modules/mod_userdir.so
>
> _______________________________________________________________________
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.beta.launchpad.net/ubuntu/+question/6866/+confirm?answer_id=8
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Ralph Janke (txwikinger) said :
#11

Check with

lsof -a | grep mod_userdir

if the module is really loaded.

If not, try restarting the apache server.

If it is, look through your config files, maybe you have left a UserDir configuration somewhere when you tried to copy it from the fedora which interferes.

Revision history for this message
Dennis Dirdjaja (dcd-ditsch) said :
#12

In Feisty, mod_userdir is installed but disabled by default. You have to run »sudo a2enmod userdir« manually to enable it. Don't forget to restart apache afterwards.

Revision history for this message
T. S. Ferreira (tsferreira) said :
#13

It seems to be loaded: I get a several lines answer:

apache2 5122 root mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5187 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5188 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5189 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5190 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5191 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so
apache2 5490 www-data mem REG 8,21 6180
8718547 /usr/lib/apache2/modules/mod_userdir.so

BTW, lsof does not accept "-a" option. I did not copy any
configuration files from my previous installation. The only thing I
did was to put the link:

    userdir.load -> ../mods-available/userdir.load

in /etc/apache2/mods-enabled!

-- tsf

On 5/20/07, Ralph Janke <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>
> Status: Open => Answered
>
> Ralph Janke proposed the following answer:
> Check with
>
> lsof -a | grep mod_userdir
>
>
> if the module is really loaded.
>
> If not, try restarting the apache server.
>
> If it is, look through your config files, maybe you have left a UserDir
> configuration somewhere when you tried to copy it from the fedora which
> interferes.
>
> _______________________________________________________________________
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.beta.launchpad.net/ubuntu/+question/6866/+confirm?answer_id=10
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.beta.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
T. S. Ferreira (tsferreira) said :
#14

If I try sudo a2enmod userdir I get:

   This module is already enabled!

-- tsf

On 5/20/07, Dennis Dirdjaja <email address hidden> wrote:
> Your question #6866 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/6866
>
> Dennis Dirdjaja proposed the following answer:
> In Feisty, mod_userdir is installed but disabled by default. You have to
> run »sudo a2enmod userdir« manually to enable it. Don't forget to
> restart apache afterwards.
>
> _______________________________________________________________________
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/6866/+confirm?answer_id=11
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/6866
>

--
T. S. Ferreira

Revision history for this message
Best T. S. Ferreira (tsferreira) said :
#15

Problem solved: both files "userdir.conf" and "userdir.load" (or links) must be present in the directory mods-enabled!

-- tsf