79241867

Date: 2024-12-01 15:21:31
Score: 1
Natty:
Report link

The answer from @Isaac Souza it's correct but i want to add some details, my problem was in fact that in my server the project was in var/www/html/project/project-back/ but inside the container the project was in var/www/html and this caused the 404 file not found.

To fix it i had to change the apache config for the subdomain and add this :

    # Remove the proxy, you need to use SetHandler "proxy:fcgi://127.0.0.1:9000"
    # ProxyPreserveHost On
    # ProxyPass / fcgi://localhost:9000/
    # ProxyPassReverse / fcgi://localhost:9000/

    # This need to be the symfony public path inside the container
    Define container_root "/var/www/html/public"
    <FilesMatch \.php$>
        Require all granted
        SetHandler "proxy:fcgi://127.0.0.1:9000"
        ProxyFCGISetEnvIf "true" DOCUMENT_ROOT   "${container_root}"
        ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "%{HANDLER}${container_root}%{reqenv:SCRIPT_NAME}"
    </FilesMatch>
    UnDefine container_root

You can't use the ProxyPass in this case you need to use SetHandler "proxy:fcgi://127.0.0.1:9000" and define the DOCUMENT_ROOT with the path inside the container to the symfony public folder.

I've found the solution here : https://serverfault.com/questions/1047449/apache-php-fpm-setup-results-in-file-not-found

Sorry i didn't saw it before, so i guess the question can be marked as duplicate.

Reasons:
  • RegEx Blacklisted phrase (1): i want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Anis B.