Apache virtualhost on LAN and permissions?

General support questions
rothmail
Posts: 40
Joined: 2005/12/27 06:33:34
Location: New York City metro area

Apache virtualhost on LAN and permissions?

Postby rothmail » 2018/03/16 13:49:34

On the LAN, I want to setup an instance with the hostname of staging. The hostname is staging has its IP addressed assigned by DHCP from the router.

By default, http://staging points to /var/www/html.

I want it to point to a specific user at: /home/myuser/www.

I see in httpd.conf that I could change the DocumentRoot /var/www/html to /home/myuser/www, but I'm not sure how to deal with permissions for this, since all files in DocumentRoot have the ownership and group by apache.

How should I set this up? Should I have myuser added to the Apache group?

I'm doing all this so that staging matches what will be uploaded on the public hosting service.

I want this all to work, and I'm trying to avoid a mess with having to run chgrp and chown every time myuser writes files in /home/myuser/www.
Last edited by rothmail on 2018/03/21 19:32:44, edited 1 time in total.

User avatar
TrevorH
Forum Moderator
Posts: 22313
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Apache virtualhost on LAN and permissions?

Postby TrevorH » 2018/03/16 14:07:59

Why not use use /var/www/yourhost and have everything work out of the box?
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

rothmail
Posts: 40
Joined: 2005/12/27 06:33:34
Location: New York City metro area

Re: Apache virtualhost on LAN and permissions?

Postby rothmail » 2018/03/16 14:22:18

TrevorH wrote:Why not use use /var/www/yourhost and have everything work out of the box?


Good question.

Because the directory structure for the hosting service's VPS is this:

/home/myuser/www

They don't use /var/www/html on the hosting VPS. So each time something is uploaded, it required editing a configuration file.