1

Topic: Error in Adminer configuration template

==================== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====


I found an error in the nginx configuration template of Adminer.


/etc/nginx/templates/adminer.tmpl

# Sample setting for Adminer: http://adminer.org/

# -----------------------------------------
# How to get it working:
#
#   mkdir /var/www/adminer
#   cd /var/www/adminer
#   wget http://www.adminer.org/latest.php
#   chmod +x latest.php
#
# Warning: for security concern, it's recommended to change the URL '/adminer'
#          to another random string to avoid login attempts from bad guys.
#          for example, change the url to '^/HIoWCwogSHukIbGL'.
#
# -----------------------------------------
# If you cannot login to MySQL server as root user:
#
# New MySQL or MariaDB support plugin authentication, by default, the root
# account has setting `user.plugin=unix_socket` (in `mysql` database). The
# `auth_socket` authentication plugin authenticates clients that connect from
# the local host through the Unix socket file, this prevents access via network
# connection, including Adminer. To make it working, please disable this
# authentication plugin with sql commands below:
#
#   sql> USE mysql;
#   sql> UPDATE user SET plugin='' WHERE User='root';
#
# Refer to MySQL document for more details:
# https://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html

location ~ ^/adminer {
    include /etc/nginx/templates/hsts.tmpl;
    include /etc/nginx/templates/fastcgi_php.tmpl;

    fastcgi_index latest.php;
    fastcgi_param SCRIPT_FILENAME /var/www/adminer/latest.php;

    # Access control
    #allow 127.0.0.1;
    #allow 192.168.1.10;
    #allow 192.168.1.0/24;
    #deny all;
}

Including this conf in /etc/nginx/sites-available/00-default-ssl.conf produce the following error on nginx restart.

systemd[1]: Starting The nginx HTTP and reverse proxy server...
nginx[26234]: nginx: [emerg] "fastcgi_index" directive is duplicate in /etc/nginx/templates/adminer.tmpl:39
nginx[26234]: nginx: configuration file /etc/nginx/nginx.conf test failed
systemd[1]: nginx.service: control process exited, code=exited status=1
systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
systemd[1]: Unit nginx.service entered failed state.
systemd[1]: nginx.service failed.

I solved renaming latest.php in index.php and altering adminer.tmpl in this way:

# Sample setting for Adminer: http://adminer.org/

# -----------------------------------------
# How to get it working:
#
#   mkdir /var/www/adminer
#   cd /var/www/adminer
#   wget http://www.adminer.org/latest.php
#   chmod +x latest.php
#
# Warning: for security concern, it's recommended to change the URL '/adminer'
#          to another random string to avoid login attempts from bad guys.
#          for example, change the url to '^/HIoWCwogSHukIbGL'.
#
# -----------------------------------------
# If you cannot login to MySQL server as root user:
#
# New MySQL or MariaDB support plugin authentication, by default, the root
# account has setting `user.plugin=unix_socket` (in `mysql` database). The
# `auth_socket` authentication plugin authenticates clients that connect from
# the local host through the Unix socket file, this prevents access via network
# connection, including Adminer. To make it working, please disable this
# authentication plugin with sql commands below:
#
#   sql> USE mysql;
#   sql> UPDATE user SET plugin='' WHERE User='root';
#
# Refer to MySQL document for more details:
# https://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html

location = /adminer {
    return 301 /adminer/;
}

location ~ ^/adminer/ {
    include /etc/nginx/templates/hsts.tmpl;
    include /etc/nginx/templates/fastcgi_php.tmpl;

    #fastcgi_index latest.php;
    fastcgi_param SCRIPT_FILENAME /var/www/adminer/index.php;

    # Access control
    #allow 127.0.0.1;
    #allow 192.168.1.10;
    #allow 192.168.1.0/24;
    #deny all;
}

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Error in Adminer configuration template

Why not simply comment out the "fastcgi_index" line in adminer.tmpl?

3

Re: Error in Adminer configuration template

ZhangHuangbin wrote:

Why not simply comment out the "fastcgi_index" line in adminer.tmpl?

Thanks Zhang, evaluating your question I fully understand why the "fastcgi_param SCRIPT_FILENAME" is not defined in the fastcgi_params file neither in fastcgi_php.tmpl, this way is enough comment out the "fastcgi_index" param.