Cannot Access the Sen2Agir web interface, tried starting httpd but failed

Hi,

The issue is that you’re already running a web server on that system. To find out what it’s doing, you can simply open http://localhost/ from a Remote Desktop session. That web server was not installed by the Sen2Agri installer, and does not come with the system by default. I can’t tell why it’s there, but there must be a (good) reason.

But yes, you can indeed pass this on to the system administrator if you have one.

Again, sorry for the inconvenience.

Hi,

I seemed that our system administrator installed Only Office web server, being used by our institute.

I’ll try to see what can I do about this.

Thank you.

Hello again,

I followed your instruction and here’s the results.

httpd

Screenshot at 2018-01-23 11-25-42

Screenshot at 2018-01-23 11-32-22

This is somewhat confusing for me. Is this preferring to /etc/nginx/nginx.conf? or do I need to create a new directory?

And lastly, these are the results of:

sudo nginx -t

nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/nginx.conf:35
nginx: configuration file /etc/nginx/nginx.conf test failed

sudo systemctl reload nginx (ok, no error)

Regards.

Starting Apache (http) as described above.

All right. There’s a warning (it doesn’t know the hostname), but it’s fine to ignore it.

This is somewhat confusing for me. Is this preferring to /etc/nginx/nginx.conf? or do I need to create a new directory?

Yes, you should put that snippet in a file like /etc/nginx/conf.d/sen2agri.host.domain.conf. The error you’re getting is because the upstream and server blocks should be placed inside http. If you move it to a file in will be included there (see the include /etc/nginx/conf.d/*.conf; line. The advantage of this is that it’s easier to make modifications to a site without affecting the others.

And you should replace sen2agri.host.domain with something more appropriate, like the server name (e.g. sen2agri.esscgeo-sen2agri.localdomain). You’ll either need a DNS entry (contact your network administrator for that) or, you’re accessing it from few computers you can add it to the hosts file. In the latter case, edit /etc/hosts (on Linux) and add a line with IP sen2agri.host.domain. Replace IP with the server’s IP address and sen2agri.host.domain with the name you chose before.

sudo systemctl reload nginx (ok, no error)

nginx -t reported an error (because of the misplaced upstream block), so after the reload I suspect that nginx and Only Office are no longer working. To fix that, remove the two blocks you added and run systemctl reload nginx again.

Hi again,

I followed all your advices, just want to share the outcomes.

Here’s the result for the command sudo nginx -t:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reloading of nginx is also ok. However, I still wasn’t able to access the system’s web interface.
I am sharing this post to my network administrator and update you in this post.

Regards.

All right. As a note, after the steps above, the web UI should be accessible at e.g. http://sen2agri.host.domain/.

Hi there,

My apologies for bothering you again in this thread. Our system administrator already uninstalled the only office web server. I also reinstall the whole sen2agri system (system ad’s request). However, as I tried to see the status of httpd, these results appeared:

[brentf@ESSCGeo-Sen2Agri conf.d]$ systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-02-06 14:21:18 +08; 8min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 10512 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 10510 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 10510 (code=exited, status=1/FAILURE)

Feb 06 14:21:17 ESSCGeo-Sen2Agri httpd[10510]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Feb 06 14:21:17 ESSCGeo-Sen2Agri httpd[10510]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Feb 06 14:21:17 ESSCGeo-Sen2Agri httpd[10510]: no listening sockets available, shutting down
Feb 06 14:21:17 ESSCGeo-Sen2Agri httpd[10510]: AH00015: Unable to open logs
Feb 06 14:21:18 ESSCGeo-Sen2Agri systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Feb 06 14:21:18 ESSCGeo-Sen2Agri kill[10512]: kill: cannot find process ""
Feb 06 14:21:18 ESSCGeo-Sen2Agri systemd[1]: httpd.service: control process exited, code=exited status=1
Feb 06 14:21:18 ESSCGeo-Sen2Agri systemd[1]: Failed to start The Apache HTTP Server.
Feb 06 14:21:18 ESSCGeo-Sen2Agri systemd[1]: Unit httpd.service entered failed state.
Feb 06 14:21:18 ESSCGeo-Sen2Agri systemd[1]: httpd.service failed.

And here are the results of sudo ss -pantl | grep :80

LISTEN     0      128          *:80                       *:*                   users:(("nginx",pid=4351,fd=7),("nginx",pid=1854,fd=7))

Also, the early edits I had in the /etc/ninginx/conf.d/ directory reverted back to their default values.

Brent

Hi,

If you no longer require Only Office, you should stop and disable nginx:

systemctl stop nginx
systemctl disable nginx
systemctl restart httpd

Hello,

The sen2agri web page came back but I cannot logged-in, and the webpage says:

Screenshot at 2018-02-07 11-49-38

Regards.

Hi,

it looks like it’s unable to connect to the Postgres database. Can you check its status?

systemctl status postgresql-9.4`

The connection parameters are set in /var/www/html/ConfigParams.php, you might also want to check that file.

Hello.

Here’s the status of postgresql-9.4:

● postgresql-9.4.service - PostgreSQL 9.4 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-9.4.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2018-02-07 13:00:40 +08; 5 days ago
     Docs: https://www.postgresql.org/docs/9.4/static/
  Process: 13283 ExecStart=/usr/pgsql-9.4/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=1/FAILURE)
  Process: 13276 ExecStartPre=/usr/pgsql-9.4/bin/postgresql94-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)

Feb 07 13:00:39 ESSCGeo-Sen2Agri pg_ctl[13283]: < 2018-02-07 13:00:39.237 +08 >LOG:  could not bind IPv4 socket: Address already in use
Feb 07 13:00:39 ESSCGeo-Sen2Agri pg_ctl[13283]: < 2018-02-07 13:00:39.237 +08 >HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
Feb 07 13:00:39 ESSCGeo-Sen2Agri pg_ctl[13283]: < 2018-02-07 13:00:39.273 +08 >FATAL:  lock file "/var/run/postgresql/.s.PGSQL.5432.lock" already exists
Feb 07 13:00:39 ESSCGeo-Sen2Agri pg_ctl[13283]: < 2018-02-07 13:00:39.273 +08 >HINT:  Is another postmaster (PID 1590) using socket file "/var/run/postgresql/.s.PGSQL.5432"?
Feb 07 13:00:40 ESSCGeo-Sen2Agri pg_ctl[13283]: pg_ctl: could not start server
Feb 07 13:00:40 ESSCGeo-Sen2Agri pg_ctl[13283]: Examine the log output.
Feb 07 13:00:40 ESSCGeo-Sen2Agri systemd[1]: postgresql-9.4.service: control process exited, code=exited status=1
Feb 07 13:00:40 ESSCGeo-Sen2Agri systemd[1]: Failed to start PostgreSQL 9.4 database server.
Feb 07 13:00:40 ESSCGeo-Sen2Agri systemd[1]: Unit postgresql-9.4.service entered failed state.
Feb 07 13:00:40 ESSCGeo-Sen2Agri systemd[1]: postgresql-9.4.service failed.

On the other hand, here are the contents of /var/www/html/ConfigParams.php:

<?php
    class ConfigParams {
        static $CONN_STRING  = 'host=localhost port=5432 dbname=sen2agri user=admin password=sen2agri';
        static $SERVICES_URL = 'http://localhost:8080/dashboard';
        static $SITE_ID;
        static $USER_NAME;

        static function init() {
            // set login information
            if (isset($_SESSION['siteId']) && isset($_SESSION['userId']) && isset($_SESSION['userName'])) {
                self::$SITE_ID   = $_SESSION['siteId'];
                self::$USER_NAME = $_SESSION['userName'];
            }
        }
    }

    ConfigParams::init();
    ?>

Regards.

Hi,

Didn’t this happen to you before? I think you had two versions of Postgres installed on the server:

sudo ss -pantl | grep 5432

Hello,

Here are the results:

LISTEN 0 128 127.0.0.1:5432 *:* users:(("postgres",pid=1590,fd=3))

Yeah you’re right, another version of postgres was installed.
Screenshot at 2018-02-13 10-23-10
Should I uninstall the other version of my postgres?

Brent

9.4 is ours. You should check what the old one is used for.

$ sudo -u postgres psql
postgres=# \l

Hello again,

I uninstalled all the packages of postgres 9.2 (it was updated automatically by the CentOS system) and successfully started the postgresql-9.4.service, but still can’t log in successfully in the web interface. Any suggestions?
Screenshot at 2018-02-13 10-46-20

Cheers.

Are you getting the same error?

Maybe the Sen2Agri database was created on the previous instance. You can use the same psql command to check if a sen2agri database exists.

If not, you can re-run the install script. If should be relatively quick the second time.

Hello,

I re-run the sen2agri install script but my login was still not successful (shows the same log-in error).
Do I need to log-out from CentOS?

Brent

No, you shouldn’t need to. Does sudo -u postgres psql sen2agri work?

Hello,

Sorry, been busy these days.
Anyway, yes I can access the sen2agri database from psql but still can’t log in successfully from the web interface.
(using the default credentials).

Hello Inicola,

Finally found out a solution for this one.
I just used your answer here, from the previous post

Regards and thanks a lot.

1 Like