January 14, 2021

Fedora 32 -- Httpd - set up a web server

Somebody wants to put stuff into ~/public_html on a machine I set up.
su
dnf -y install httpd
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
systemctl start httpd.service
systemctl enable httpd.service

Now, where do files need to go? I aim a browser at my host and see the usual Fedora test page. Apparently this is apache, and who knows why Fedora doesn't just call it that, but whatever. The test page tells me to put content into /var/www/html . I copy an index.html file there from some other content I have laying around, hit reload in my browser, and there it is! So they weren't lying to me.

I would rather put my web content on /u1/www. Doing that involves editing /etc/httpd/conf/httpd.conf . I make the changes here to change the documentroot to /u1/www and restart the server:

systemctl restart httpd.service

I toss a file into /u1/www, hit reload on my browser, and it all looks good.

The tricks to set up "public_html" directories are in /etc/httpd/conf.d/userdir.conf .
Also see the page in the apache docs:

This is simple, but the conf file needs to be edited to enable this, and the service restarted.


Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org