apache config

Hi,
i have configured apache on one server.
its working quite fine.
when i say http://www.myserver.com
it is working.

now i want to browse my homedirectory, so when i give http://www.myserver.com/~msnr

it is not displaying the page.
it is saying the requested url was not found.

how to enable that..???


msnr
LVL 1
msnrAsked:
Who is Participating?
 
samriConnect With a Mentor Commented:
msnr,

Just to double check:  I have proposed two options, which one do you take, the one with Alias or the pre-defined home_dir.


My config that works:
----
Alias /samri /export/home/samri

<Directory "/export/home/samri">
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
----
And the URL.  And please make sure the last slash (/) is there.

http://www.myserver.com:8000/samri/

0
 
samriCommented:
Basically you can not browse to you home directory by default.  If you still insist to do that, create an alias which point to you home directory.  For example, if your homedir  is /home/msnr

Alias /msnr /home/msnr

<Directory "/home/msnr">
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

or another options is to use the homedir feature that is built into apache.  This will require you to create a dir name public_html (by default) in you home directory.  The access will be in the form of http://yourserver/~login

Excerpt from httpd.conf
#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

#

Almost all configuration syntax and example are properly laid out in the apache config file.

good luck
0
 
msnrAuthor Commented:
Hi samri,

i have added the alias entry as u said.
and i have given permissions 755 to my login msnr directory.

but when i say http://myserver.com/~msnr

it is saying

Forbidden

You don't have permission to access /~msnr/ on this server.

what could be the problem.?

msnr
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
msnrAuthor Commented:
Hi samri,

i have added the alias entry as u said.
and i have given permissions 755 to my login msnr directory.

but when i say http://myserver.com/~msnr

it is saying

Forbidden

You don't have permission to access /~msnr/ on this server.

what could be the problem.?

msnr
0
 
msnrAuthor Commented:
samri,

thanks for the response,
i have taken the alias entry among the two u proposed.

i have given the same thing,
and given like this
http://myserver.com/~msnr/

still it is saying permission problem.

suggest me .


msnr
0
 
samriCommented:
msnr,

since you have taken the Alias approach, try accessing the url by /msnr/ only and not (~).
/~msnr/ is for the 2nd option (the public_html approach).

Btw, what is the error message in the server log (error_logs)
0
 
msnrAuthor Commented:
thanks samri,
it is working,

but i have to set manually for each login id.

so can u tell me how to configure ~msnr.

In my httpd.conf  public_html is already there.
what else should i need to do.?
should i need to add any extra package for that.?



msnr
0
 
samriCommented:
msnr,

The following config is from httpd.conf file should work.  On my machine the permission is 755.  The dir public_html should be a directory in user home dir. Not you do not need any extra packages to enable this.

Excerpt from httpd.conf
                     #
                     # UserDir: The name of the directory which is appended onto a user's home
                     # directory if a ~user request is received.
                     #
                     <IfModule mod_userdir.c>
                        UserDir public_html
                     </IfModule>

                     #

Link to Apache Docs website:

And yes, I believe that each login (user) should have their own public_html (or whatever dir you decide it to be).  It will take some line of shell scripts to do that.  But it really depends to the user (who own their homedir to decide whether they want to utilize it or not).

http://httpd.apache.org/docs/mod/mod_userdir.html

Another option is to look at mod_rewrite (http://httpd.apache.org/docs/mod/mod_rewrite.html), where you can utilize apache's url rewriting feature to further enhance mass virtual hosting.

This section (http://httpd.apache.org/docs/misc/rewriteguide.html) is very helpful.
0
 
msnrAuthor Commented:
thanks samri,

but can i make config, so that total user homedirectory will come insted of only public_html directory on the browser when i say http://myserver.com/~login/
?

or can i replace public_html with user home directory name, so that full directory will come.?

msnr
0
 
msnrAuthor Commented:
one more thing samri,
i have created one public_html directory
and when i say http://myserver.com/msnr

it is working fine.

but when i say http://myserver.com/~msnr/

it is giving the error.

why.?

msnr
0
 
samriCommented:
msnr,

I think the http://myserver.com/msnr works because of the Alias directives that you enabled earlier.  But the http://myserver.com/~msnr/ is still not working really puzzled be.  Have you checked the  httpd.conf for the directive (aplogy if this is a repetition), but based on my experience, it should be quite straight forward.

Basically the public_html dir dan be anything, as long as it correspond with the on in  the httpd.conf.  The directory should be inside the users homedir.  For example if my homedir if /export/home/samri, the full path tp public_html should be /export/home/samri/public_html.

Another thing that you might want to double check the is following keywords, see if it is there.

LoadModule userdir_module     libexec/mod_userdir.so
.
.
AddModule mod_userdir.c

Another thing is to look in the  error log (error_log), try doing a
tail -f error_log  (make sure the path is correct), and try (from your browser), to go to http://myserver.com/~msnr/

0
 
msnrAuthor Commented:
my httpd.conf is like this...
is it ok..??


UserDir public_html

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>

msnr
0
 
samriCommented:
msnr,

it looks ok to me.

so does it works?

If it still does not work, check for the "AddModule mod_userdir.c" in the config file, and see if it does exist.

Or perhaps,

UserDir public_html

without the "<IfModule>... </IfModule>"... give it a try.
0
 
samriCommented:
msnr,

The is somehow quite a similar Question in PAQ.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20159495

I can' purchase the solution due to "Javascript error on EE".

From the description, it sounds similar to your userdir problem.

I'll post it as soon as I can view the page.
0
 
msnrAuthor Commented:
my httpd.conf is like this...
is it ok..??


UserDir public_html

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>

msnr
0
 
samriCommented:
-- quoted from
http://www.experts-exchange.com/jsp/qShow.jsp?ta=apache&qid=20159495
--
  From: izwiz  Date: 08/02/2001 10:41AM PST
Are the permissions on the users directory set so that the apache user (normally nobody) has read access?

Please recheck the permission on public_html diretory.  Makefure the httpd user has read access to it.  chmod 755 public_html should do the work.

0
 
msnrAuthor Commented:
nice response from samri.
0
 
msnrAuthor Commented:
nice response from samri.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.