How to create a public_html directory

I have a working apache webserver. I created a virtual server /var/www/experiment. I configured apache and I can access the Alma server page from my workstation browser.

Now, I have a bunch of .txt files I want to make public.
I used chmod -R 755 /var/www/experiment
I used chown -R myname: myname /var/www/experiment

I either get a 404 or I don’t have permissions.

What am I doing wrong. I’m a beginner remember

I’m a little surprised that chmod -R 755 didn’t work, but the ownership is wrong. User apache:apache should own the files, since the web server needs access. Also check that your document root is correct, it’s more common to put them in /var/www/html/....

404 is odd, 403 would probably be SELinux - try ls -lZ /var/www/experiment or look at the apache logs.

chmod’ing .txt files to 755 makes no sense, that would be for the containing directory, the files should be 644 or somesuch, not executable.

Unless you changed the default value for Apache httpd DocumentRoot , then the problem is you have put the files in the wrong place. You need to put then in /var/www/html/ not /var/www/experiement/

“How to create a public_html directory” does not seem relevant to what you are trying to do. A user would create a directory called public_html in their home directory and put files in there that they wanted to be available at https://whatever/~username/ See Per-user web directories - Apache HTTP Server Version 2.4 But that is not relevant if you want the content available at https://whatever/