How to configure a web server on a laptop

Discussion in 'Apache' started by webjedi, Apr 13, 2010.

  1. #1
    I have installed Centos 5.4 on a laptop.
    My purpose is to test certain scripts on the laptop before uploading to main commercial server.

    but when I find DocumentRoot "/var/www/html"

    I find that it's quite weird that web files must be store in root directory access.

    also for commercial web host, users don't have access to root folder, so my main purpose is to store web files in a user directory, i.e. /home/jedi/wwww/html instead of root directory, i.e. /var/www/html.

    so may I know which portion of /etc/httpd/conf/httpd.conf should I edit in order to store web files in a user directory?

    In fact I have modify the following
    on line 281 and 282
    # DocumentRoot "/var/www/html"
    DocumentRoot "/home/jedi/www/html"

    On line 306 and 307
    # <Directory "/var/www/html">
    <Directory "/home/jedi/www/html">

    but I get

    Forbidden

    You don't have permission to access / on this server.
    Apache/2.2.3 (CentOS) Server at localhost Port 80

    any help is rendered is really appreciated!

    selinux is disabled
    
    [root@localhost ~]# rpm -qa | grep selinux
    libselinux-1.33.4-5.5.el5
    libselinux-devel-1.33.4-5.5.el5
    libselinux-python-1.33.4-5.5.el5
    selinux-policy-devel-2.4.6-255.el5_4.4
    libselinux-utils-1.33.4-5.5.el5
    selinux-policy-targeted-2.4.6-255.el5_4.4
    selinux-policy-2.4.6-255.el5_4.4
    [root@localhost ~]# /usr/sbin/getenforce
    Disabled
    [root@localhost ~]#
    
    
    Code (markup):
     
    webjedi, Apr 13, 2010 IP
  2. RHS-Chris

    RHS-Chris Well-Known Member

    Messages:
    1,007
    Likes Received:
    35
    Best Answers:
    10
    Trophy Points:
    150
    #2
    You are looking for the userdir option. If you change your config similar as below, this will allow you to access http://yourip/~username, and run scripts from the user directories.

    
    <IfModule mod_userdir.c>
        #
        # UserDir is disabled by default since it can confirm the presence
        # of a username on the system (depending on home directory
        # permissions).
        #
        #UserDir disable
    
        #
        # To enable requests to /~user/ to serve the user's public_html
        # directory, remove the "UserDir disable" line above, and uncomment
        # the following line instead:
        #
        UserDir public_html
    
    </IfModule>
    
    #
    # Control access to UserDir directories.  The following is an example
    # for a site where these directories are restricted to read-only.
    #
    <Directory /home/*/public_html>
        AllowOverride All
    #    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    #    <Limit GET POST OPTIONS>
    #        Order allow,deny
    #        Allow from all
    #    </Limit>
    #    <LimitExcept GET POST OPTIONS>
    #        Order deny,allow
    #        Deny from all
    #    </LimitExcept>
    </Directory>
    Code (markup):
    Hope this helps,
    Chris
     
    RHS-Chris, Apr 13, 2010 IP