Results 1 to 19 of 19

Thread: Apache Basics

  1. #1
    Join Date
    Oct 2007
    Posts
    48

    Apache Basics

    Happy New Year guys! This year I would like to stay in here and enjoy the atmosphere here while meeting good people and professionals here.

    Here is my situation:

    My server is pointing to an IP, ie http://xxx.xxx.xxx.xx. Recently a domain (http://www.xxxx.com.au) has been setup using this IP as DNS and pointed to the server. And I have saved all the html files in http://www.xxxx.com.au/~sample/. So in web browser http://www.xxx.com.au doesnt open the homepage as http://www.xxxx.com.au/~sample/index.htm but it open a page saying, "Great Succes! Apache is working on ........."

    My question is:

    How can I point http://www.xxxx.com.au/~sample/ to www.xxxx.com.au using apache?

    Cheers,
    Ivan

  2. #2
    Join Date
    Mar 2007
    Location
    Phoenix, AZ
    Posts
    132
    Check your DocumentRoot directive in httpd.conf file
    Cheers,
    Sivanandhan, P. (a.k.a. apsivam)
    My Blog Site

  3. #3
    Join Date
    Oct 2007
    Posts
    48
    May I know how can I do this? Sorry I am just too new on these.

  4. #4
    Join Date
    Mar 2007
    Location
    Phoenix, AZ
    Posts
    132
    There will be an entry in your httpd.conf file which will have an entry called DocumentRoot. Change it to point to your directory or move your file to the directory mentioned as DocumentRoot
    Cheers,
    Sivanandhan, P. (a.k.a. apsivam)
    My Blog Site

  5. #5
    Join Date
    Oct 2007
    Posts
    48
    okay I ll try that now.

  6. #6
    Join Date
    Oct 2007
    Posts
    48
    Okay, anything I have to make sure to not bring any problem to anything?

  7. #7
    Join Date
    Mar 2007
    Location
    Phoenix, AZ
    Posts
    132
    take a backup of your existing httpd.conf file or what ever file you plan to make changes.
    Cheers,
    Sivanandhan, P. (a.k.a. apsivam)
    My Blog Site

  8. #8
    Join Date
    Oct 2007
    Posts
    48
    At the moment the ip is point to the server instead of the directory. If this have been made would that affect the running of the server?

  9. #9
    Join Date
    Oct 2007
    Posts
    48
    "/etc/httpd/conf/httpd.conf" [Permission Denied] 0,0-1 All

    When I tried to edit it, the putty said this error message. Why is that?

  10. #10
    Join Date
    Oct 2007
    Posts
    48
    and when I sudo http.conf,
    and after I typed the password and press enter. It said, username is not in the sudoers file. This incident will be reported.

    What can I do?

  11. #11
    Join Date
    Oct 2007
    Posts
    48
    I just reckon should I only use root as a login to access the httpd.conf file? If so, could you tell me where to see the password of my "root"?

    Thanks heap!

  12. #12
    Join Date
    Oct 2007
    Posts
    48
    Quote Originally Posted by apsivam View Post
    take a backup of your existing httpd.conf file or what ever file you plan to make changes.
    How can I make a backup for this file?

  13. #13
    Join Date
    Oct 2007
    Posts
    48
    Quote Originally Posted by apsivam View Post
    There will be an entry in your httpd.conf file which will have an entry called DocumentRoot. Change it to point to your directory or move your file to the directory mentioned as DocumentRoot
    I found it finally, but can you tell me how do I edit it? Cheers.

  14. #14
    Join Date
    Mar 2003
    Location
    United States
    Posts
    3,675
    How can I make a backup for this file?
    cp /path/to/httpd.conf /path/to/httpd.conf_bak

    Replace /path/to/ with the correct path, otherwise just cd into the directory and don't use paths. Either or, doesn't matter which route you choose.

    I found it finally, but can you tell me how do I edit it? Cheers.
    pico httpd.conf
    (for beginners and it also may not be installed)

    or

    vi httpd.conf
    (vi editor, more advanced, type "i" [without quotes] to insert, type/edit what you need and then hit Esc., and then type ":wq" to save and exit. - again no quotes)

  15. #15
    Join Date
    Oct 2007
    Posts
    48
    Quote Originally Posted by CrazyTech View Post
    cp /path/to/httpd.conf /path/to/httpd.conf_bak

    Replace /path/to/ with the correct path, otherwise just cd into the directory and don't use paths. Either or, doesn't matter which route you choose.



    pico httpd.conf
    (for beginners and it also may not be installed)

    or

    vi httpd.conf
    (vi editor, more advanced, type "i" [without quotes] to insert, type/edit what you need and then hit Esc., and then type ":wq" to save and exit. - again no quotes)

    Thanks I can finally see it, but one thing I am really concern here is:

    (1) I am worrying about what problem would it cause if I change the directory in DocumentRoot? I am not sure change dir from /usr/local/apachel/htdocs/ to home/mydir/ is okay for the modernBill I previously installed before.

    (2) May I know when it will take effect after I modify the conf?
    Last edited by cctv; 01-03-2008 at 06:29 PM.

  16. #16
    Join Date
    Oct 2007
    Posts
    48
    I changed it but it seems that it doesnt take any effect yet...

  17. #17
    Join Date
    Oct 2007
    Posts
    48
    Its working now! thanks a lot! It actually need not to wait long. And I actually have to restart the file in shell using the following solutions:

    When you make changes to configuration files, you may want to test your changes before implementing them. This can be done by typing apachectl configtest at the command line while logged in as root. This will test the main configuration file and all other configuration files that are included in it. If the changes are successful, you will need to restart the http daemon in order for the changes to take effect. In Linux, this sometimes can be done with the service command:

    service httpd restart

    If that doesn't work, find httpd in one of the startup directories of /etc. In Red Hat Linux, it's located in /etc/rc.d/init.d/. If it's there, you could do the following to restart Apache:

    /etc/rc.d/init.d/httpd restart

  18. #18
    Join Date
    Mar 2003
    Location
    United States
    Posts
    3,675
    I apologize for that, completely failed to mention the part where you have to restart Apache. Glad you figured that out.

  19. #19
    Join Date
    Oct 2007
    Posts
    48

    *

    Quote Originally Posted by CrazyTech View Post
    I apologize for that, completely failed to mention the part where you have to restart Apache. Glad you figured that out.
    No worries, you helped me out alot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •