I think I see the problem. Your SetHandler is applying to every possible URL in the virtual host, without regard for whether it is a PHP file or not. Thus everything gets passed to PHP, even if it is a static file. And because PHP's interpreting the static file as PHP, you get the results you got.

You should instead send only requests for PHP files to the handler, by selecting them by filename:

        <FilesMatch \.php$>
            SetHandler "proxy:fcgi://127.0.0.1:9072"
        </FilesMatch>

You can then remove the unnecessary redundant <Files> bits that you had added.

Answer from Michael Hampton on serverfault.com
🌐
Ask Ubuntu
askubuntu.com › questions › 757305 › apache-2-4-7-doesnt-load-all-css-files
apache2 - Apache 2.4.7 doesn't load all .css files - Ask Ubuntu
Was using "StyleSheet.css" but when I renamed as "styles.css" it suddenly works! Running XAMPP on Windows 10. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... End of Life Notice: Ubuntu 25.04 (Plucky Puffin) reached End of Life on... 2 Ubuntu 12.04 Apache 2 - Inline CSS working but external CSS not working
🌐
SitePoint
sitepoint.com › server config
Updated to Apache 2.4 and now my style sheets do not load - Server Config - SitePoint Forums | Web Development & Design Community
July 24, 2023 - I’ve configured Apache 2.4 exactly as the previous version, updated to PHP 8, but now no stylesheets are loading, just html. Using developer tools in Edge (and other browsers) I can apply the styles and everything looks fine. AddType text/css .css is included in my config file.
Top answer
1 of 2
4

I think I see the problem. Your SetHandler is applying to every possible URL in the virtual host, without regard for whether it is a PHP file or not. Thus everything gets passed to PHP, even if it is a static file. And because PHP's interpreting the static file as PHP, you get the results you got.

You should instead send only requests for PHP files to the handler, by selecting them by filename:

        <FilesMatch \.php$>
            SetHandler "proxy:fcgi://127.0.0.1:9072"
        </FilesMatch>

You can then remove the unnecessary redundant <Files> bits that you had added.

2 of 2
1

The 403 error usually comes from a permission error. It could either be at the directory or the files level.

In your case, from what I can see (only the file and the apache doc root directory permissions), permissions seems fine.

Could you share with us the parents directories permissions? (it could be the /var/www/dev/ that have too restrictive permissions)

If the permissions aren't allowing "other", 0755 should do it...

chmod 0755 /var/www/dev

Also, /var/www/dev should belong to "dev-admin". If that isn't the case, I would suggest to change the ownership of it:

chown dev-admin: /var/www/dev

And @Michael Hampton is right. None of your changes were required (on a default CentOS 7 Apache configuration).

Ohh! Just to make sure that we are covering all the bases... Does dev-admin is the Apache user?

If not, you may either change it within the main Apache configuration or by changing the dev directory (recursive) with the proper user.

🌐
Stack Overflow
stackoverflow.com › questions › 74431117 › why-is-css-not-displaying-on-my-html-page-with-apache
Why is CSS not displaying on my html page (with Apache)? - Stack Overflow
You should include a reference to the external style sheet file inside the head section, and not in style section. here is an example: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/mobile.css"> <style> // your styles </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › general programming discussion
CSS not linking with Apache 2 Server - Raspberry Pi Forums
That accesses the filesystem directly ... ways of fixing your issue. The simplest is to move the CSS directory from /var/www/CSS to /var/www/html/CSS (or the less shouty /var/www/html/css) and change your hrefs to get rid of the ".."....
🌐
GitHub
github.com › firefly-iii › firefly-iii › issues › 2799
Webpage CSS not loading on Self Hosted Apache Web Server · Issue #2799 · firefly-iii/firefly-iii
November 6, 2019 - There was an error while loading. Please reload this page. ... Description I am running Raspbian Buster on a Pi 3B+ with Apache2, MySQL, and PHP7.3 installed. As far as I know, all necessary PHP modules are installed. When I load the firefly-iii web interface, the site is rendered but without any styling (see here).
Author   gustavoholst
🌐
GitHub
github.com › termux › termux-app › issues › 1608
external css linked with html not working with apache server · Issue #1608 · termux/termux-app
June 18, 2020 - Problem description External css not applyint styles to html on apache localhost Steps to reproduce both html and css are in same folder(/data/data/com.termux/files/usr/share/apache2/default-site/htdocs) apachectl start Html file ...
Author   tathastu871
Find elsewhere
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › community › general discussion
css file not loading - Please Help!!!! - Raspberry Pi Forums
User Andyroo suggested that I post this issue on the Apache Server forums. I did that and received a response back that the issue I was having was most likely due to the fact that I did not have a trailing forward slash on the ip addresses within my .conf file.
🌐
Stack Overflow
stackoverflow.com › questions › 60118163 › apache2-css-not-loading-when-the-file-is-in-another-folder
html - Apache2: CSS not loading when the file is in another folder - Stack Overflow
February 8, 2020 - The root directory is example so you have to put /example before assets the link should be like the example below, Another idea is to remove the / before assets as it is not the root directory (i.e it is directory) of the index.php file. <link type="text/css" href="/example/assets/css/style.css" rel="stylesheet">
🌐
Spiceworks
community.spiceworks.com › software & applications
CSS files not loading, 404 error - Software & Applications - Spiceworks Community
February 2, 2022 - My page shows up with no formatting, something is giving a 404 error for the CSS files. In the apache access logs I see this - - [02/Feb/2022:17:01:34 -0500] "GET / /login HTTP/1.1" 200 10820 "http:// / / list" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ...
🌐
SitePoint
sitepoint.com › server config
Updated to Apache 2.4 and now my style sheets do not load - Page 2 - Server Config - SitePoint Forums | Web Development & Design Community
July 26, 2023 - I’ve configured Apache 2.4 exactly as the previous version, updated to PHP 8, but now no stylesheets are loading, just html. Using developer tools in Edge (and other browsers) I can apply the styles and everything looks …
🌐
Quora
quora.com › Why-wont-Apache-update-source-CSS-documents-when-I-reload-an-HTML-document
Why won't Apache update 'source' CSS documents when I reload an HTML document? - Quora
Answer (1 of 4): Because Apache never got the chance to do that. This is called cache and it is one of the various schemes to improve performance and reduce latency and bandwidth usage. In simpler terms, whenever you visit a website, Browser try to store the static information locally and when ...
🌐
Sling Academy
slingacademy.com › article › apache-url-rewriting-error-css-and-js-not-loading
Apache URL rewriting error: CSS & JS files not loading (4 solutions) - Sling Academy
Notes: Using the correct ‘RewriteBase’ can greatly simplify your rewrite rules and prevent many common issues with file loading. However, it won’t resolve issues related to the presence of ‘RewriteCond’ directives that filter out file requests, something which the next solutions address. Add conditions to your rewrite rules to exclude CSS and JS files. Rewrite conditions (`RewriteCond`) instruct Apache to only apply ‘RewriteRule’ when the conditions are met.
🌐
Stack Overflow
stackoverflow.com › questions › 70081269 › apache-css-does-not-link-to-my-web-page
bash - Apache - CSS does not link to my web page - Stack Overflow
I configured a web server so when I access to my localhost, a bash script runs and echoes an HTML document so the browser can render it. This works correctly. I'm having troubles making the CSS wor...