Solved

apache config

Posted on 2001-08-08
18
189 Views
Last Modified: 2010-03-04
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
0
Comment
Question by:msnr
  • 10
  • 8
18 Comments
 
LVL 15

Expert Comment

by:samri
ID: 6366860
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
 
LVL 1

Author Comment

by:msnr
ID: 6367526
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
 
LVL 15

Accepted Solution

by:
samri earned 50 total points
ID: 6371006
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
 
LVL 1

Author Comment

by:msnr
ID: 6371118
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
 
LVL 1

Author Comment

by:msnr
ID: 6371124
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
 
LVL 15

Expert Comment

by:samri
ID: 6373168
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
 
LVL 1

Author Comment

by:msnr
ID: 6375060
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
 
LVL 15

Expert Comment

by:samri
ID: 6375867
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
 
LVL 1

Author Comment

by:msnr
ID: 6378512
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:msnr
ID: 6378604
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
 
LVL 15

Expert Comment

by:samri
ID: 6378977
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
 
LVL 1

Author Comment

by:msnr
ID: 6379123
my httpd.conf is like this...
is it ok..??


UserDir public_html

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

msnr
0
 
LVL 15

Expert Comment

by:samri
ID: 6380648
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
 
LVL 15

Expert Comment

by:samri
ID: 6380701
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
 
LVL 1

Author Comment

by:msnr
ID: 6382843
my httpd.conf is like this...
is it ok..??


UserDir public_html

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

msnr
0
 
LVL 15

Expert Comment

by:samri
ID: 6383035
-- 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
 
LVL 1

Author Comment

by:msnr
ID: 6384236
nice response from samri.
0
 
LVL 1

Author Comment

by:msnr
ID: 6384237
nice response from samri.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now