Grav: Cannot get grav to work on a nginx reverse proxy

Created on 12 Nov 2018  路  3Comments  路  Source: getgrav/grav

Hello.

We are trying to set up a grav instance on our server using nginx 1.15.5 as a reverse proxy for an httpd 2.4.6 server. But it's not working, we can't register an admin.

_s1: is our nginx server
s4b: is our httpd server (which includes grav files)_

_the instance is supposed to be behind https://url.com/grav_

this is our nginx config on s1:

location /grav {
  rewrite  ^/grav/(.*) /$1 break;
  proxy_pass http://s4b;
  proxy_set_header Host server.com;
  proxy_set_header X-Real-IP $remote_addr;
}

this our httpd config on s4b:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/csites/server.com/public
    ServerName server.com
    ServerAlias server.com

    ErrorLog logs/grav.error
    CustomLog logs/grav.access combined
    <IfModule mod_deflate.c>
       SetOutputFilter DEFLATE
       AddOutputFilterByType DEFLATE text/plain text/html text/xml
       Header append Vary User-Agent env=!dont-vary
    </IfModule>
</VirtualHost>

then, on system/config/system.yaml we changed the following values:

custom_base_url: /grav
reverse_proxy_setup: true

then we go to url.com/grav, we get the admin prompt and once clicking submit I get this

Oops there was a problem, please check your input and submit the form again.

I did google already, and tried few things, but nothing worked.
Except commenting the code that returns that error, but once I did that

  1. I was able to register an admin
  2. I wasn't able to login due to "Invalid Security Token", I also did follow the instructions but nothing worked.

FWIW, this did not happen when pointing a grav instance only to a domain.com. it only seems to be a problem when trying to use a "subfolder".

Thanks :)

question

All 3 comments

Did you use the example webserver-configs/nginx.conf that's included with Grav as a basis for your configuration???

Hey @rhukster , thanks for replying.

The nginx conf won't work for us since this is a grav instance running on a apache instance, so we just use proxypass

any other ideas?

Did you use the example webserver-configs/nginx.conf that's included with Grav as a basis for your configuration???

Either you're skim these configs with your ass or you incompitent dummy that just unable to see difference between fastcgi and proxy_pass.
Make your choice.

Anyway this bug still persist and i get mumbling like this:

PHP webserver requires a router to run Grav, please use:
php -S exs-elm.ru:80 system/router.php

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tmos picture tmos  路  21Comments

ekumlin picture ekumlin  路  37Comments

giansi picture giansi  路  17Comments

jens-t picture jens-t  路  18Comments

balajmarius picture balajmarius  路  17Comments