Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, setting up a server for the first time from scratch. Stand alone web server to be added to an outside center later. Trying to make it work has been ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    69

    Need help with apache


    Hi, setting up a server for the first time from scratch. Stand alone web server to be added to an outside center later.

    Trying to make it work has been a chore..and when I move to the new center I will be gettng ip addresses and not using my home dsl thing..which makes testing tougher.

    I am trying to set up the nameserver on my box to send to sites on my box. I think I got that working.

    setting up apache is no joke though...wow. Hard as heck.

    First I want to change the doc root to the /home/ folder and that was easy.
    Then I added users. Each user then had an 'html foilder underneath their folder and that is where the directive in the apache conf file sent them.

    so user bob would have /home/bob/html/<websitename.com>/ as their directive root.

    I also played iwth permissions on these folders to get to them with a browser but that did not work either.

    I know some use symn links to send to the home directory, but I hear that can be a problem, so I just wanted to make it work as intended by changing docroot in the conf file (changed all instances of it)

    centos 5.1

    Quite frankly I have issues with the documentation, isn't that a shock.

    What I am trying to do is this.....

    put users in the /home/ directory. Put users websites in there too. Nameserver to direct to those sites as per the apache.conf.

    I just cannot get it to work....I mostly get 'forbidden' which means apache is not getting permission to the files I guess. (I have disabled selinux by the way).

    Does the files have to be under apache user or group?

    any guru wanna give me that hint to help me figure this out will be thanked profusely.

    I hear symlinks have many issues and figure regualr old change doc root would not be soo bad..the permission thing is killing me.

  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    well, firstly apache has to be able to read the files and folders, and it probably can't.

    wouldn't it be easier to put the actual user folder in apache root
    /var/www/bob/
    /var/www/mary/
    ...........

    and give apache permissions on the directorys. then give the users permissions for their folders and give them a symlink to their home directory? you could do it the reverse but to my mind it seems like it would make more sense to put it all under apache's root.

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    69
    Quote Originally Posted by jledhead View Post
    well, firstly apache has to be able to read the files and folders, and it probably can't.

    wouldn't it be easier to put the actual user folder in apache root
    /var/www/bob/
    /var/www/mary/
    ...........

    and give apache permissions on the directorys. then give the users permissions for their folders and give them a symlink to their home directory? you could do it the reverse but to my mind it seems like it would make more sense to put it all under apache's root.
    sure would seem easier...but there is that pesky matter of the whole 'partition' thing. Home is for users and their stuff and var, for a web server, should be on a separate part due to prevention of size issues to crash the server.

    making the docroot default to /home/www/* is no different than using the original var/www/ etc .

    unfortunately, haven't quite found the tutorial that deals with neat permission issues, changing docroot, etc for simple webserver.

    frustrating, but I will figure it out.

    I know a lot of others out there would like a nice step by step how to on making a simple web server function with a nameserver and use the home directory..lol..I know this as I read a gazillion sites all asking for help doing jus that.

    so...when I figure it out, I will post a link to a how to for the rest of us..

    should I ever figure out the steps..first time is always the hardest, repeating is easy.

    sheesh, more pizza please.

  4. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,110
    In your apache config file (httpd.conf?) there should be an entry 'If Module mod_userdir and a line just below it, UserDir, after the UserDir, enter 'html'.
    Make sure no hash (#) mark to the left of these lines. The default is public_html but html should work.
    Then put an 'index.html' file in the 'html' directory for each user, welcome to my really cool website or whatever. chmod 644 index.html, chmod 755 html, and user directories.
    Try to access it in your browser for say, user bob: http://localhost/~bob/index.html (the '~' to the left of bob is necessary, it's the key to the left of the number one, hit shift.
    This works on my local machine so hopefully it will work for you for testing anyhow. Good Luck!

  5. #5
    Just Joined!
    Join Date
    Mar 2008
    Posts
    69
    Quote Originally Posted by yancek View Post
    In your apache config file (httpd.conf?) there should be an entry 'If Module mod_userdir and a line just below it, UserDir, after the UserDir, enter 'html'.
    Make sure no hash (#) mark to the left of these lines. The default is public_html but html should work.
    Then put an 'index.html' file in the 'html' directory for each user, welcome to my really cool website or whatever. chmod 644 index.html, chmod 755 html, and user directories.
    Try to access it in your browser for say, user bob: http://localhost/~bob/index.html (the '~' to the left of bob is necessary, it's the key to the left of the number one, hit shift.
    This works on my local machine so hopefully it will work for you for testing anyhow. Good Luck!
    Thanks, I was thinking usedir might have soemthig to do with it (just orderd like the only 3 good books from amazon dealing with apache printed in the last year, good 150 bucks there...lol)

    I am gonna try this.

    I am actually trying to access the server from my home comp via the dsl router to test using explorer to view it. so I am going to 192.xx.xxx.xx/mywebsitefoldername/index.html

    this is via the nameserver, which appears to be working with no errors (sees the files correctly)

    and virtual host as best as I could figure it.

    I made the folders myself under the username folder and used winscp to upload the files.

    orginally they were owned by root as i made them. Then I changed them to the user, but root was the group. Then I tried chaging them to the users own group. I have no idea how to make apache own them or if they have to be.

    I imagine I must have the virtual user set up wrong in apache, although it shows no errors when running or I just am missing something like the usedir.

    thanks for the help, will let you know.
    Thank you for taking your time and telling me this.

    Every dang book i have right now, and I have lots, all go step by step to install apache like you are a baby. Then they assume you know all about configuring and gloss over setting it up and go right into neat directives.

    O'Reilly books love to do that too...

    grrr....

  6. #6
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,110
    I'm running suse so I'm not sure about centOS, on suse the user for apache is called 'wwwrun' and the group is 'www'. I don't believe it's the same for centOS. I think it's 'apache' for user and for group. You might check to see if you have a user/group apache. Sorry I don't know anything about virtual hosts so can't help you there.

    I know what you mean about glossing over configuring. Had lots of problems with that in the past. Anyhow, good luck with it and let us know how things work out.

Posting Permissions

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