Skip to content

Proxying nginx behind Apache <-> Nextcloud #381

@masscream

Description

@masscream

Hello, this issue looks simple but I can't get around it. I went through a lot of tutorials and config examples but none of them brought me to success. I run things on Apache / http setup (ssl is added through external ProxyPass, does not matter much in the issue) - Nextcloud, Onlyoffice, also Nginx - which I was kind of forced to install because of Oo. I couldn't find alternate config for Apache on the internet. Therefore Apache is running on port 80, Nginx 81 and I use virtual paths for everything. e.g.
http://www.hostname.hs/nextcloud. My intention is to create one for Oo too, but there goes the struggle. I was able to put together a config for Apache which is passing the requests correctly to Nginx, but Nginx doesn't care and follows everywhere its own path. I tried adding the config also (and also only) for nginx but except "duplicate configs" and "outside locations" conflicts in its complex hostfiles, I could not get it to work.

Apache config

#OnlyOffice
	Define VPATH /onlyoffice
        Define DS_ADDRESS localhost:81

        <Location ${VPATH}>
                Require all granted
                SetEnvIf Host "^(.*)$" THE_HOST=$1
                RequestHeader setifempty X-Forwarded-Proto http
                RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
                RequestHeader edit X-Forwarded-Host (.*) $1${VPATH}
                ProxyAddHeaders Off
        </Location>

        ProxyPassMatch ^\${VPATH}(.*)(\/websocket)$ "ws://${DS_ADDRESS}/$1$2"
        ProxyPass ${VPATH} "http://${DS_ADDRESS}"
        ProxyPassReverse ${VPATH} "http://${DS_ADDRESS}"

Therefore http://www.hostname.hs/onlyoffice/ brings me correctly to main page http://www.hostname.hs/onlyoffice/welcome/ but there, when I hit "Go to test example", nginx forwards me only to http://www.hostname.hs/example/, which is not valid. I do not have to say that probably due to this, also my NC connector is not working and isn't opening my documents correctly. If there's another issue as well, I may find out after successful virtual path creation. Thanks for any ideas.

P.S. I have used the official tutorial, but nothing was mentioned there about altering any of the nginx config files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions