Error 502 Bad Gateway Nginx

1,006 views
Skip to first unread message

Abdulaziz Esawi

unread,
Jun 15, 2022, 5:42:08 AM6/15/22
to archivematica
hey everyone I am a new to archivematica. I have installed archivematica on my VM using VMware Workstation. I have followed the guide below, but when i try to access this machine using its IP address which is 172.16.0.12:8000 or even without the port number, I get the error message 

502 Bad Gatewaynginx/1.18.0 (Ubuntu). 

even when i use curl i get the same error


what are the main steps to identify and solve this problem? 

Regads, 

Murilo Souza dos Santos

unread,
Jun 15, 2022, 5:46:48 PM6/15/22
to archivematica
Hi, have you unlocked the ports used by the Dashboard? Maybe that could be it


--
Configure your firewall (if applicable)

On Ubuntu, the default firewall configuration tool is ufw (Uncomplicated Firewall). To see the firewall status, enter:

sudo ufw status

If ufw is active, you must ensure that it is not blocking the ports used by the dashboard and the Storage Service, i.e., 80 and 8000.

sudo ufw allow 22/tcp 
sudo ufw allow 80/tcp 
sudo ufw allow 8000/tcp 
sudo ufw reload

Abdulaziz Esawi

unread,
Jun 16, 2022, 4:30:10 AM6/16/22
to archivematica
Hey mate, 
Thanks for the response. Yes, I have made the ufw configs, but the problem has not been solved.
Regards 

Amaya Rodrigo

unread,
Jun 16, 2022, 10:42:37 AM6/16/22
to archiv...@googlegroups.com

Abdulazi,

Have you tried looking at the /var/log/nginx/error.log and /var/log/nginx/access.log
There will be more clues in there, can you please paste the relevant lines here?


--
You received this message because you are subscribed to the Google Groups "archivematica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivematic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archivematica/f8360271-a509-415c-b9e1-a63794fb33e7n%40googlegroups.com.


--
Amaya M Rodrigo Sastre (she/her/bofh) - sysadmin@artefactual

Abdulaziz Esawi

unread,
Jun 18, 2022, 8:26:09 AM6/18/22
to archivematica
Hello Amaya,
Thanks for your time. Here are the outputs of the commands you've mentioned in your reply, including the IPtables configs;
arch@archeieve:~$ tail -f /var/log/nginx/error.log
2022/06/18 12:13:33 [error] 1200#1200: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "127.0.0.1:8000"
ii2022/06/18 12:14:47 [error] 1200#1200: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.16.0.236, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "172.16.0.12:8000"
2022/06/18 12:14:47 [error] 1200#1200: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.16.0.236, server: , request: "GET/favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8001/favicon.ico", host: "172.16.0.12:8000", referrer: "http://172.16.0.12:8000/"


arch@archeieve:~$ tail -f /var/log/nginx/access.log
127.0.0.1 - - [18/Jun/2022:12:13:33 +0000] "GET / HTTP/1.1" 502 166 "-" "curl/7.68.0"
172.16.0.236 - - [18/Jun/2022:12:14:47 +0000] "GET / HTTP/1.1" 502 568 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
172.16.0.236 - - [18/Jun/2022:12:14:47 +0000] "GET /favicon.ico HTTP/1.1" 502 568 "http://172.16.0.12:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
172.16.0.236 - - [18/Jun/2022:12:18:07 +0000] "GET / HTTP/1.1" 502 568 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
172.16.0.236 - - [18/Jun/2022:12:18:07 +0000] "GET /favicon.ico HTTP/1.1" 502 568 "http://172.16.0.12:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"


And here is the configurations' lines of the IPtables

Chain ufw-user-input (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8000
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8002
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https


Hope that this information is helpful for you
Regads

Abdulaziz Esawi

unread,
Jun 19, 2022, 9:31:02 AM6/19/22
to archivematica
& here is the configs behind 


/etc/nginx/sites-available


On Thursday, June 16, 2022 at 4:42:37 PM UTC+2 arod...@artefactual.com wrote:
nginx.png

Amaya Rodrigo

unread,
Jun 20, 2022, 10:49:00 AM6/20/22
to archiv...@googlegroups.com
From your error log, I am seeing your storage service is not up:

On Sat, Jun 18, 2022 at 2:26 PM Abdulaziz Esawi <aziz...@gmail.com> wrote:
2022/06/18 12:13:33 [error] 1200#1200: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "127.0.0.1:8000"

Can you pate the output of:

# service archivematica-storage-service status

If it's down, just do a restart and see if that solves it.
If it (the SS service) doesn't come up you need to see what the issue is and fix it.
Let us know what you find out and we'll help further if needed.

Best of luck!

 

Abdulaziz Esawi

unread,
Jun 21, 2022, 7:06:37 AM6/21/22
to archivematica
Hello Amaya, 
Thanks again for your help
Please have a look at the output below: 
arch@archeieve:~$ service archivematica-storage-service status
● archivematica-storage-service.service - Archivematica Storage Service
     Loaded: loaded (/lib/systemd/system/archivematica-storage-service.service; enabled; vendor preset: enabled)
     Active: failed (Result: core-dump) since Tue 2022-06-21 01:27:15 UTC; 9h ago
    Process: 2397 ExecStart=/usr/share/archivematica/virtualenvs/archivematica-storage-service/bin/gunicorn --config /etc/archivematica/storage-service.gunicorn-config.py storage_service.ws>
   Main PID: 2397 (code=dumped, signal=ABRT)

Jun 21 01:27:15 archeieve systemd[1]: archivematica-storage-service.service: Scheduled restart job, restart counter is at 5.
Jun 21 01:27:15 archeieve systemd[1]: Stopped Archivematica Storage Service.
Jun 21 01:27:15 archeieve systemd[1]: archivematica-storage-service.service: Start request repeated too quickly.
Jun 21 01:27:15 archeieve systemd[1]: archivematica-storage-service.service: Failed with result 'core-dump'.
Jun 21 01:27:15 archeieve systemd[1]: Failed to start Archivematica Storage Service.

arch@archeieve:~$ service archivematica-storage-service start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'archivematica-storage-service.service'.
Authenticating as: archeive (arch)
Password:
==== AUTHENTICATION COMPLETE ===
arch@archeieve:~$ service archivematica-storage-service status
● archivematica-storage-service.service - Archivematica Storage Service
     Loaded: loaded (/lib/systemd/system/archivematica-storage-service.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: core-dump) since Tue 2022-06-21 10:59:35 UTC; 916ms ago
    Process: 16701 ExecStart=/usr/share/archivematica/virtualenvs/archivematica-storage-service/bin/gunicorn --config /etc/archivematica/storage-service.gunicorn-config.py storage_service.w>
   Main PID: 16701 (code=dumped, signal=ABRT)
 ESCOC

 preset: enabled)
16ms ago
/bin/gunicorn --config /etc/archivematica/storage-service.gunicorn-config.py storage_service.wsgi:application (code=dumped, signal=ABRT)


Amaya Rodrigo

unread,
Jun 21, 2022, 10:42:45 AM6/21/22
to archiv...@googlegroups.com

Abdulazi,

The service is failing to start, that is why nginx is showing a connection refused in the logs, it tries to talk to the SS, but the poor thing is not listening, it dies after trying to start :)

The status output (bolded):

On Tue, Jun 21, 2022 at 1:06 PM Abdulaziz Esawi <aziz...@gmail.com> wrote:
Jun 21 01:27:15 archeieve systemd[1]: Stopped Archivematica Storage Service.
Jun 21 01:27:15 archeieve systemd[1]: archivematica-storage-service.service: Start request repeated too quickly.
Jun 21 01:27:15 archeieve systemd[1]: archivematica-storage-service.service: Failed with result 'core-dump'.
Jun 21 01:27:15 archeieve systemd[1]: Failed to start Archivematica Storage Service.

The restart fails too:
 
   Active: activating (auto-restart) (Result: core-dump) since Tue 2022-06-21 10:59:35 UTC; 916ms ago
   Process: 16701 ExecStart=/usr/share/archivematica/virtualenvs/archivematica-storage-service/bin/gunicorn --config /etc/archivematica/storage-service.gunicorn-config.py storage_service.w>
   Main PID: 16701 (code=dumped, signal=ABRT)

There is something wrong with your system (python version?).
Core dumped looks to me like there's a the wrong version of a dependency installed, or some library/python is broken, too old or too new.

Can you please try to restart again, using, as root:
systemctl reset-failed
service archivematica-storage-service restart

Then go to the logs and see what's going on in:
/var/log/archivematica/storage-service/storage_service.log
/var/log/archivematica/storage-service/storage_service_debug.log

Please paste the output (just the last lines, the ones that show the restart and its error) and let's see how we can fix it.
I am sorry this is taking forever, but debugging via email sucks :)

Thanks!



Abdulaziz Esawi

unread,
Jun 22, 2022, 6:36:18 AM6/22/22
to archivematica
Hey Amaya,
Thanks a lot. 
here is what you have required 
Last login: Wed Jun 22 10:12:48 2022 from 172.16.0.236
arch@archeieve:~$ service archivematica-storage-service restart

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'archivematica-storage-service.service'.

Authenticating as: archeive (arch)
Password:
==== AUTHENTICATION COMPLETE ===
arch@archeieve:~$ /var/log/archivematica/storage-service/storage_service.log
-bash: /var/log/archivematica/storage-service/storage_service.log: No such file or directory
arch@archeieve:~$ /var/log/archivematica/storage-service/storage_service_debug.log
-bash: /var/log/archivematica/storage-service/storage_service_debug.log: No such file or directory
arch@archeieve:~$

Amaya Rodrigo

unread,
Jun 24, 2022, 12:14:37 PM6/24/22
to archiv...@googlegroups.com

Abdulazi,

Let's recap.

You are running Ubuntu, can you tell me what version?
Last supported version is Ubuntu 18. If you are running anything newer (20 or 22) it will not work).

On Wed, Jun 22, 2022 at 12:36 PM Abdulaziz Esawi <aziz...@gmail.com> wrote:
arch@archeieve:~$ service archivematica-storage-service restart
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'archivematica-storage-service.service'.
Authenticating as: archeive (arch)
Password:
==== AUTHENTICATION COMPLETE ===

What happens after you run this? Does this start at all?
(I'm guessing no, because the log files don't even exist, from what you pasted below).
 
arch@archeieve:~$ /var/log/archivematica/storage-service/storage_service.log
-bash: /var/log/archivematica/storage-service/storage_service.log: No such file or directory
arch@archeieve:~$ /var/log/archivematica/storage-service/storage_service_debug.log
-bash: /var/log/archivematica/storage-service/storage_service_debug.log: No such file or directory

Can you please paste the output of running:
ls -l /var/log/archivematica/
ls -l /var/log/archivematica/storage-service/

and the contents of /etc/default/archivematica-storage-service
Just run
cat /etc/default/archivematica-storage-service
and paste the output here (feel free to obscure passwords or API keys).

Thanks!

Abdulaziz Esawi

unread,
Jun 27, 2022, 5:39:39 AM6/27/22
to archivematica
Hello Amaya, 
Thanks again for your effort. 
Yes, you're right, although my friend told me it's been supported by the newer versions of Ubuntu. 
I have installed it on an older version of ubuntu. Here is what I have got. 
archivematic loginpage.jpg

I have entered the user archivematica with password demo, but the system says its not correct. I have also entered the usename and password that I have created in the welcome page, but also not correct. 
Thanks 

Amaya Rodrigo

unread,
Jun 27, 2022, 11:40:35 AM6/27/22
to archiv...@googlegroups.com
Try admin (Unless you created a user named "archivematica").
You can always reset any password running:

sudo -u archivematica bash -c " \
    set -a -e -x
    source /etc/default/archivematica-dashboard || \
        source /etc/sysconfig/archivematica-dashboard \
            || (echo 'Environment file not found'; exit 1)
    cd /usr/share/archivematica/dashboard
    /usr/share/archivematica/virtualenvs/archivematica/bin/python \
        manage.py changepassword USERNAME
";

Just change USERNAME to the user you want to reset.



--
You received this message because you are subscribed to the Google Groups "archivematica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivematic...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages