Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not get FPM working with Host-Webserver #895

Closed
Lawei opened this issue Oct 11, 2019 · 4 comments
Closed

Can not get FPM working with Host-Webserver #895

Lawei opened this issue Oct 11, 2019 · 4 comments

Comments

@Lawei
Copy link

Lawei commented Oct 11, 2019

Hello,
i tried to setup nextcloud:fpm on my Ubuntu Linux 18.04.02 LTS Server.
I did NOT follow one of the thousands of tutorials adding another Webserver proxy container with docker compose, but tried to use my existing apache server (v2.4.29) running natively on my host (as the nextcloud Docker documentation page says it is possible).
Unfortunately i can not use the default directory (/var/www/html) on my host, and thats where the Problem begins.

My Setup:

docker run -d -v /var/docker/nextcloud/html:/var/www/html -p 9000:9000 nextcloud:fpm

and my Apache config (partial)

<VirtualHost *:443>
... (Servername, SSL-Stuff, ...)
        # Proxy nextcloud fpm
        <LocationMatch "^\/(.*\.php(.*)?)$">
                ProxyPass "fcgi://127.0.0.1:9000/var/www/html/$1"
        </LocationMatch>

        DocumentRoot /var/docker/nextcloud/html

        <Directory /var/docker/nextcloud/html>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
...
</VirtualHost>

It took me some time to get this partially working setup. But the ProxyPass seems not to be correct. When i forward fcgi requests this way, i can not handle any files with whitespaces or umlauts in their names (add/delete/create/... fails silently)!
The Examples i found for use with a separate proxy container all use another way to pass data to fcgi:

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

This does not work in my case, as the directories on host and in docker differs from each other (/var/docker/nextcloud/html vs /var/www/html), so the requests result in sth. like fcgi://127.0.0.1:9000/var/docker/nextcloud/html/index.php (which does not exist in the container).

All Documentation i found lacks a hint on this.
Can somebody help me to fix that?

@Commifreak
Copy link

Same problem - exactly the same here.

ProxyPassMatch does not work with whitespaces, SetHandler gives "File not found"...

@Commifreak
Copy link

The issue is the different docroot. This is set by Apache by force to the Apache docroot and is sent to the FPM. But the path inside the NC container is different (/var/www/html).

nginx should work here as expected

@J0WI
Copy link
Contributor

J0WI commented Jun 23, 2023

Please use https://help.nextcloud.com/ for individual deployment questions.

@J0WI J0WI closed this as completed Jun 23, 2023
@func0der
Copy link

func0der commented Dec 1, 2023

    <FilesMatch ".*\.php$">
        ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "var/www/html%{reqenv:SCRIPT_NAME}"
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>

Found here: https://serverfault.com/a/1131761/127564

Works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants