[Discuss] apache server
Greg Rundlett (freephile)
greg at freephile.com
Wed Dec 10 11:43:18 EST 2014
To be more clear, Apache WON'T serve content out of home directories. It
doesn't matter if "FollowSymlinks" is on.
You can move the content to /var/somewhere and symlink to it - ensuring
that "FollowSymlinks" is on. (E.g. ln -s /var/somewhere /var/www/html/foo)
and http://localhost/foo will display contents of "somewhere" because it's
NOT a sub-directory of /home/
Or, you can turn on mod_userdir and use the tilde notation in your URL
pattern to access content in a user's home directory. (E.g.
http://localhost/~moylan to serve up the content of
/home/moylan/public_html by default.) If it's truly per user content, then
mod_userdir is helpful. If you're trying to do real web serving (like
installing WordPress or something), don't do it out of your home directory.
If you just want an easy way to modify files when you login to the machine,
then do the inverse of linking TO your home: make a directory in the
server's document root, and symlink to it FROM your home directory. You
have to be sure to chown the whole tree to your user and give it group
ownership to the Apache server user (eg. www-data) ensuring group
read+write perms and setting the sticky bit so that new files are created
the same way. Then create the symbolic link in your home directory. This
way, you login to the host, and can easily work on ~/webstuff
Eg. (note: you have to figure out what APACHE_USER is for your system.
It's likely 'www-data', 'nobody', or 'apache'. Then substitute that in the
command below)
sudo mkdir /var/www/html/webstuff
sudo chown -R $USER:APACHE_USER /var/www/html/webstuff
cd /var/www/html/webstuff
find ./ -type d -exec sudo chmod u=rwx,g+rwxs,o=rx {} \;
find ./ -type f -exec sudo chmod ug=rw,o=r {} \;
If you need multiple people to work on "webstuff", then create a group
(e.g. "developers"), add yourself, APACHE_USER, and those other people to
"developers" and substitute "developers" in place of APACHE_USER for the
group ownership.
Also, I didn't notice that you said you were using Fedora. The whole
"a2enmod" a2dismod" is a Debian-ism. Enabling Apache modules in Fedora is
done the old-fashioned way (
http://docs.fedoraproject.org/en-US/Fedora/12/html/Deployment_Guide/s1-apache-addmods.html).
To reload Apache in Fedora, you can use sudo service httpd restart.
Generally speaking, you don't want to modify httpd.conf for your website.
This is because httpd.conf already has a line in it (Include conf.d/*.conf)
that loads every conf file found in the conf.d directory. You want to
create a separate conf file(s) there: mysite.conf, and then set specific
directives as needed. To help users, there is a graphical administration
tool in Fedora that will let you manage the server-wide settings of
httpd.conf (
http://docs.fedoraproject.org/en-US/Fedora/12/html/Deployment_Guide/s1-apache-config-ui.html
)
hth,
Greg
Greg Rundlett
http://eQuality-Tech.com
http://freephile.org
On Tue, Dec 9, 2014 at 5:29 PM, Greg Rundlett (freephile) <
greg at freephile.com> wrote:
> Apache also has a module (mod_userdir) and related directives for serving
> content from user home directories. See
> http://httpd.apache.org/docs/current/howto/public_html.html
>
> If you remove the symbolic link 'moylan' and specify (in httpd.conf, or
> conf.d/mysite.conf)
> UserDir www
>
> Then
> sudo a2enmod userdir
> sudo apache2ctl reload
>
> you should be able to browse what's in moylan/www by requesting
> localhost/~moylan/
>
> Greg Rundlett
> http://eQuality-Tech.com
> http://freephile.org
>
> On Tue, Dec 9, 2014 at 5:00 PM, Derek Martin <invalid at pizzashack.org>
> wrote:
>
>> On Tue, Dec 09, 2014 at 04:45:21PM -0500, dan moylan wrote:
>> > /var/www/off-lnk.htm (linked to /home/moylan/www/lnk/off.htm -- same
>> file)
>> > produces the following:
>> >
>> > Forbidden
>> > You don't have permission to access off-lnk.htm on this server.
>>
>> Most likely explanation is that your home directory, or a path
>> component in it, is not readable by the user as which the server runs.
>>
>> > and ...
>> > /var/www/off-lnk-rut.htm (linked to /root/off-lnk-rut.htm -- again,
>> same file)
>> > produces the following:
>> >
>> > Not Found
>> > The requested URL /off-rut-lnk.htm was not found on this server.
>>
>> Same problem, more severe permissions restriction. Most likely root's
>> home directory is locked down completely (this is the default on most
>> distros AFAIK), so the server's user can't see anything inside it.
>>
>> --
>> Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
>> -=-=-=-=-
>> This message is posted from an invalid address. Replying to it will
>> result in
>> undeliverable mail due to spam prevention. Sorry for the inconvenience.
>>
>>
>> _______________________________________________
>> Discuss mailing list
>> Discuss at blu.org
>> http://lists.blu.org/mailman/listinfo/discuss
>>
>>
>
More information about the Discuss
mailing list