SanderT2001 / fryske-oranjekoeke

Fryske Oranjekoeke - The simple MVC PHP Framework
1 stars 3 forks source link

Please provide more support for apache #25

Open YvarRavy opened 5 months ago

YvarRavy commented 5 months ago

i see i can only work with nginx but i would like to have access to apache also

SanderT2001 commented 5 months ago

Thanks for the suggestion.

I've created two possible Apache Configuration files, one as a .htaccess and one as a virtualhost. I don't have an Apache configuration up-and-running at the moment, can you test it?

Apache VirtualHost

<VirtualHost *:80>
    ServerName fryske_oranjekoeke_dev
    DocumentRoot /var/www/fo_test/app/public
    DirectoryIndex index.php

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/fo_test/app/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

        # If the request was made to a JS/CSS File, don't rewrite.
        <If "%{REQUEST_URI} =~ /\.(css|js|map|jpe?g|png)$/">
            RewriteEngine Off
        </If>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ /index.php [L]
    </Directory>

    # For every request with a PHP File, let the PHP Engine handle this request.
    <FilesMatch \.php{{Message.content}}gt;
        SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>

    # Deny requests to .ht(access) & the .github directory.
    <DirectoryMatch "^/.*/(\.ht|\.github)">
        Require all denied
    </DirectoryMatch>
</VirtualHost>

Apache .htaccess

# Enable the rewrite engine
RewriteEngine On

# If the request was made to a JS/CSS File, don't rewrite.
RewriteCond %{REQUEST_URI} !\.(css|js|map|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php [L]

# For every request with a PHP File, let the PHP Engine handle this request.
<FilesMatch \.php{{Message.content}}gt;
    SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>

# Deny requests to .ht(access) & the .github directory.
<FilesMatch "^(\.ht|\.github)">
    Require all denied
</FilesMatch>

Thanks in advance!