onlyoffice-owncloud icon indicating copy to clipboard operation
onlyoffice-owncloud copied to clipboard

Proxying nginx behind Apache <-> Nextcloud

Open masscream opened this issue 4 years ago • 1 comments

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.

masscream avatar Apr 28 '22 10:04 masscream

I actually misplaced this issue, this repo would be much more suitable. Anyway, I gave up, I needed to get it working, therefore I configured my Apache for a brand new Virtualhost - onlyoffice.hostname.hs which is working now correctly, just with a little troubleshooting. The question stays - Is it possible to use onlyoffice with the virtual path and/or rewrite its base config files for the use with the Apache server (get rid of nginx)?

masscream avatar May 03 '22 07:05 masscream