Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi, I wondered if any of you kind apache-wise folk out there could help a moron in distress... I want to learn to use PHP a bit and have installed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Location
    Cornwall, UK
    Posts
    40

    Idiots guide to setting up apache so I can learn PHP?


    Hi, I wondered if any of you kind apache-wise folk out there could help a moron in distress... I want to learn to use PHP a bit and have installed the apache packages needed, everything went swimmingly there. I would like to now set it up so that when I enter

    http://localhost/stuff/

    into my browser it actually reads documents from

    /home/rawlyn/stuff/

    I've been informed I can do this - but how?
    Thanks in advance!

    Peace,
    Rawlyn.

  2. #2
    Just Joined!
    Join Date
    Apr 2005
    Location
    /usr/home/slith
    Posts
    93
    Try this:

    edit the http.conf (may vary from distro to distro)
    change the line that says:

    DocumentRoot: "/var/www/htdocs or something"
    to
    DocumentRoo: "/home/youruser/"

    Think that will do it

  3. #3
    Just Joined!
    Join Date
    Jul 2005
    Location
    Inside the Kernel (somewhere)
    Posts
    41
    Quote Originally Posted by slith
    DocumentRoo: "/home/youruser/"
    First, that should be DocumentRoot:
    Secondly, that's THE most insecure way to do anything. By doing this, you grant all users access to /mail/ , etc in /home/user/ , and everything else created by default.

    Now, the proper way to do this:
    Code:
    Alias /stuff/ /home/user/stuff/
    Now, this will allow the user access to the entire directory, so make sure that you have the proper security setup for this.

    In addition, you should create a public_html directory, instead of having this all default to your homedir, and put your www stuff in there. This way you can simply redirect everything for your ip to that public_html directory, which is somewhat safe.

  4. #4
    Just Joined!
    Join Date
    Apr 2005
    Location
    /usr/home/slith
    Posts
    93
    He doesn't asked to be safe, did him? Lots of people come here and ask absurd things, like "how can I change permissions to 777 in -R /* ?"m and.. you dont need to be so rude with a simple typo, do you?

  5. #5
    Just Joined!
    Join Date
    Jul 2005
    Location
    Inside the Kernel (somewhere)
    Posts
    41
    He does'nt asked to be safe, did him?
    Look, you gave him incredibly poor advice. Like it or not, you did. I corrected that advice, politely. Next time, think before you give advice like that.

    The way(s) I posted to do this are the more effecient and secure ways to do this. Security, when you're working with php , apache, ANY kind of server which is (inevitably) going to be online is foremost important.

    you dont need to be so rude with a simple typo, do you?
    RUDE?
    Hardly rude at all. I corrected your typo, there's nothing "rude" about that. In fact, I was very polite about it. I didn't insult you, I didn't call you any names, or insult your typo, I merely corrected it, politely even. Please, learn the definition of "rude", as I've hardly been that.

    This is my business here, security is key, and it's going to be the first thing that comes into mind. Why? Because it's what I do for a living, what I have done for a living for the past 3 years, and what I will do for a living for the quite forseeable future. Security, and proper administration aren't learned in 1 night, they're taught, over years of this stuff. Offering poor advice like "hey, set apache's document root to your home directory", well, it's just flat out poor, insecure, and that needs to be made very clear from the start.

    If you want to be hacked, or to have your private mail, or private files distributed everywhere, hey, by all means, set apache's document root to your home directory. Just make sure to give me your ip address so I can block you from my network, so's you don't come attacking me when you get rooted, 0wn3d, and your server turns into a zombie

  6. #6
    Just Joined!
    Join Date
    Mar 2005
    Location
    Cornwall, UK
    Posts
    40
    I have to admit, that first reply confused me... for starters I can't find http.conf, only httpd.conf. But as that appears to be insecure (and although I didn't specify security, I kind of took it as read that I wouldn't want to leave my system open to the worlk), I won't be using that anyways...

    twhiting - where, and in which file, should I add the Alias line? I'm new to the whole web-server concept really, and could really do with it being spelt out for me slowly :P thanks for your help this far though

    Peace,
    Rawlyn.

  7. #7
    Linux Newbie deek's Avatar
    Join Date
    Mar 2005
    Location
    Fort Wayne, IN
    Posts
    248
    Yeah, your configuration file is httpd.conf. And that is where you would put the alias line also.
    Join the Open Source Revolution. Support GNU/Linux.

    Find me at: www.deeksworld.com
    Registered GNU/Linux User #395777

  8. #8
    Just Joined!
    Join Date
    Jul 2005
    Location
    Inside the Kernel (somewhere)
    Posts
    41
    Usually (usually), httpd.conf will be in one of two places:
    A> /etc/httpd/conf/httpd.conf
    B> /usr/local/apache/conf/httpd.conf

    It all depends on what version of httpd you're using

  9. #9
    Linux Newbie deek's Avatar
    Join Date
    Mar 2005
    Location
    Fort Wayne, IN
    Posts
    248
    In slackware 10.1, it is in /etc/apache

    Just an fyi:)
    Join the Open Source Revolution. Support GNU/Linux.

    Find me at: www.deeksworld.com
    Registered GNU/Linux User #395777

  10. #10
    Just Joined!
    Join Date
    Jul 2005
    Location
    Inside the Kernel (somewhere)
    Posts
    41
    Quote Originally Posted by deek
    In slackware 10.1, it is in /etc/apache
    Damn them slackware people for breaking the rules of where apache should go :P

Page 1 of 2 1 2 LastLast

Posting Permissions

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