Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month at the Massachusetts Institute of Technology, in Building E51.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] apache problem



On Tue, Jan 8, 2019, at 6:06 PM, dan moylan wrote:
> 
> derek martin writes:
> > On Fri, Jan 04, 2019 at 05:01:37PM -0500, dan moylan wrote:
> >> newly installed fc29 from scratch on my laptop -- apache
> >> appears to be running ok.  chrome displays
> >> localhost/welcome.htm just fine, but when i try
> >> localhost/moylan/welcome.htm, where welcome.htm is in
> >> /home/moylan/www, i get: "you don't have permission to
> >> access localhost/moylan/welcome.htm on this server"
> 
> ...
> 
> > Another possibility is that you seem to have an SELinux ACL defined on
> > the files (as indicated by the '.' character at the end of the
> > permissions in the directory listing), and your SELinux policy is in
> > some fashion forbidding access to the files by the web server.
> 
> well selinux was the issue.  i disabled it and the problem vanished.
> perhaps that's not a good idea, but i've run without it for years.
> 

Please don't disable SELinux.

With a stock Fedora 29 install, here's how to achieve what you're after, keeping SELinux and enabling mod_userdir only for your designated user:
# yum -y install httpd
# chmod +x ~moylan
* edit /etc/httpd/conf.d/userdir.conf
- add 'UserDir enabled moylan
- add 'UserDir www'
- change '<Directory "/home/*/public_html">' to '<Directory "/home/*/www">'
# systemctl restart httpd
# setsebool -P httpd_enable_homedirs on
# curl localhost/~moylan/welcome.html

If it's a legacy homedir, you may have to restore SELinux contexts:
# restorecon -Rv ~moylan


V/r,
James Cassell



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org