Configuration to run OJS 3 smoothly behind nginx reverse proxy

A lot of people struggling in configuring PKP Open Journal System 3 (OJS3) to run behind nginx reverse proxy as OJS3 does not support nginx natively

So most implementation would settle with Apache HTTPD server or install it behind nginx reverse proxy.

However the problem is that the OJS3 behave badly when placed behind nginx reverse proxy, especially when the reverse proxy is using HTTPS / TLS. This messed up the based URL in the OJS3, subsequently causing some resources from the website to be unavailable.

To solve this, you only need to add a single line in the Apache HTTPD site configuration file.

        SetEnvIf X-Forwarded-Proto "https" HTTPS=on

A full blown example is included via gist

# Mohammad Hafiz bin Ismail <mypapit@gmail.com>
# blog.mypapit.net
# this is for Ubuntu/Debian Apache server config
#/etc/apache2/sites-available/your-ojs.conf
<VirtualHost *:9080>
ServerAdmin ojs@example.com
ServerName ojs-site.example.com
ServerAlias ojs-site.com
DocumentRoot /mnt/websites/ojs/public_html
#add this line -- this is essential!!
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
<Directory /mnt/websites/ojs/public_html/>
Options FollowSymlinks
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>