1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Apache <Virtual Host> setting problem

Discussion in 'Apache' started by Polizel, Jun 28, 2010.

  1. #1
    Hello every one,
    i included follwinf in my httpd.config file

    # START CODEfrom httpd.config file placed under Listen: line

    <VirtualHost myipaddress:80>
    ServerName phpweb20
    DocumentRoot "c:/wamp/www/phpweb20/htdocs"
    <Directory "c:/wamp/www/phpweb20/htdocs">
    AllowOverride None
    Options All
    </Directory>
    php_value include_path ".;c:/wamp/www/phpweb20/include;c:/wamp/bin/php/PEAR"
    php_value magic_quotes_gpc off
    php_value register_globals off
    </VirtualHost>


    #end COde
    and i modified

    C:\Windows\System32\drivers\etc\hosts file and add the following
    myipaddress phpweb20


    and now when i try to access http://phpweb20/ from my browser i gor a 403 forbidden error.
    Any thoughts on how to do this.
    if you need any additional info i'll be glad to post it
     
    Polizel, Jun 28, 2010 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Server name needs to have a fully qualified domain name. For example:

    ServerName phpweb20.digitalpoint.com
    Code (apache):
     
    digitalpoint, Jun 28, 2010 IP
  3. KlaxoN

    KlaxoN Peon

    Messages:
    41
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try to write DocumentRoot path without quotation marks. :)
     
    KlaxoN, Jun 28, 2010 IP
  4. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    @digitalpoin I am talking abt local development here do i even then need a fully qualified domain name . what i am trying to do is ' when i type http://phpweb20/ my browser take me to my application index rather than typing http://localhost/phpweb20/index.php or any thing else i am following a book please check it , its "Appress Building Web 2.0 application with PHP" i can pm / email you the chapter if needed
     
    Polizel, Jun 28, 2010 IP
  5. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    Still need to use a fully qualified domain in the Apache config... it doesn't know if your browser is or is not using one.
     
    digitalpoint, Jun 28, 2010 IP
  6. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i am sending chapter here please tell me what to do with that 403
    Configuring the Web Server
    A typical development setup is to use your normal computer (such as your Windows or Mac OS
    machine) to write your code, while running the web server on another server. In such a case, you
    need to access the web server over a network. For example, I use a Windows machine for my
    day-to-day work, while my web server is a FreeBSD machine elsewhere in the office.
    â– Tip I aim to keep my development web server configured identically to my production server, as this
    helps to eliminate any unforeseeable issues that may arise when deploying my code (such as different
    versions of linked libraries).
    For the purposes of this book, I assume the web application is accessible using the web
    address http://phpweb20. In order to access my web server using this hostname, I make a fake
    DNS entry in my Windows host file so my browser will resolve the phpweb20 hostname to
    192.168.0.80. This is the entry I add in my Windows hostname file (c:\windows\system32\
    drivers\etc\hosts in Windows XP):
    192.168.0.80 phpweb20
    â– Note Setting up a host as described here is not related to the development of the web application, but
    rather allows you to access it in your web browser. Creating fake hostnames is a simple trick for development
    purposes, eliminating the need for a DNS server or a real domain. Once you deploy your application
    live, you will need to use a real hostname so other people can access your web site.
    If you have control over a real DNS server, you may instead prefer to create your own
    hostname. (Just keep in mind that I continually refer to phpweb20 throughout this book.)
    â– Note You could use IP-based hosting, which would allow you to simply access http://192.168.0.80.
    Since name-based hosting in Apache is arguably the most common setup, I’ve chosen instead to use the
    method described previously (that is, setting up a fake hostname). Obviously, using a real hostname is better,
    but I’ve tried to simplify matters by not requiring it for this book
    Creating a Virtual Host in Windows
    Creating a virtual host in Windows is similar to the process in the previous section, except that
    the paths must be adjusted. Note also that the PHP include_path directive uses a semicolon as
    the separator rather than a colon, since a colon is used to indicate a drive label.
    Listing 2-2 shows the Windows equivalent of Listing 2-1. Once again, you will need to
    include it in the main web server configuration file, typically found in C:\Program Files\Apache
    Software Foundation\Apache2.2\conf\httpd.conf onWindows.
    Listing 2-2.Web Server Configuration for Apache on Windows (httpd.conf)
    <VirtualHost *:80>
    ServerName phpweb20
    DocumentRoot "c:/www/phpweb20/htdocs"
    <Directory "c:/www/phpweb20/htdocs">
    AllowOverride None
    Options All
    </Directory>
    php_value include_path ".;c:/www/phpweb20/include;c:/program files/php/pear"
    php_value magic_quotes_gpc off
    php_value register_globals off
    </VirtualHost>

    please tell me how to set this up
     
    Polizel, Jun 28, 2010 IP
  7. esupportsnet

    esupportsnet Greenhorn

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    Could you please comment Opions All from the virtualhost and restart the apache and try accessing the link?
     
    esupportsnet, Jun 29, 2010 IP
  8. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Still ..Forbidden

    You don't have permission to access / on this server.
    what i do now??
     
    Polizel, Jun 29, 2010 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    Did you make the ServerName directive a fully qualified domain yet?
     
    digitalpoint, Jun 29, 2010 IP
  10. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Polizel, Jun 29, 2010 IP
  11. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    No i didn't made. I put NameVirtualHost and same host name in c:\windows\system32\drivers\etc\hosts file but it works and traditional http://localhost is available for other site (local) . problem is solved,,, .
     
    Polizel, Jun 29, 2010 IP