[ome-users] Nginx 502 Bad Gateway

Chris MacLeod ckm at glencoesoftware.com
Tue Mar 20 14:30:46 GMT 2012




On Mar 19, 2012, at 12:02 PM, Harri Jäälinoja wrote:
> Here's the diagnostics, after I set
> chmod a+rwx /opt/OMERO/OMERO.server-Beta-4.3.3/var/nginx_tmp/

How did you start nginx?  As the omero user or as root?
If you are going to run nginx on port 80 it will need to be started as root in order to bind to lower port numbers.





> 
> [omero at lmu-omero2 ~]$ omero admin diagnostics
> 
> ================================================================================
> OMERO Diagnostics 4.3.3-00d1137e-b2894
> ================================================================================
> 
> 
> Commands:   java -version                  1.7.0     (/usr/bin/java)
> Commands:   python -V                      2.4.3     (/usr/bin/python)
> Commands:   icegridnode --version          3.3.1     (/usr/bin/icegridnode)
> Commands:   icegridadmin --version         3.3.1     (/usr/bin/icegridadmin)
> Commands:   psql --version                 8.4.9     (/usr/bin/psql)
> 
> Server:     icegridnode                    running
> Server:     Blitz-0                        active (pid = 10821, enabled)
> Server:     DropBox                        active (pid = 10828, enabled)
> Server:     FileServer                     active (pid = 10850, enabled)
> Server:     Indexer-0                      active (pid = 10831, enabled)
> Server:     MonitorServer                  active (pid = 10836, enabled)
> Server:     OMERO.Glacier2                 active (pid = 10833, enabled)
> Server:     OMERO.IceStorm                 active (pid = 10841, enabled)
> Server:     PixelData-0                    active (pid = 10855, enabled)
> Server:     Processor-0                    active (pid = 10857, enabled)
> Server:     Tables-0                       inactive (disabled)
> Server:     TestDropBox                    inactive (enabled)
> 
> Log dir:    /opt/OMERO/OMERO.server-Beta-4.3.3/var/log exists
> 
> Log files:  Blitz-0.log                    10.0 MB       errors=2 warnings=9
> Log files:  DropBox.log                    8.0 KB        errors=0 warnings=3
> Log files:  FileServer.log                 1.0 KB
> Log files:  Indexer-0.log                  65.0 KB
> Log files:  MonitorServer.log              5.0 KB        errors=0 warnings=1
> Log files:  OMEROweb.log                   0.0 KB        errors=0 warnings=3
> Log files:  PixelData-0.log                8.0 KB
> Log files:  Processor-0.log                5.0 KB        errors=0 warnings=3
> Log files:  Tables-0.log                   n/a
> Log files:  TestDropBox.log                n/a
> Log files:  master.err                     2.0 KB
> Log files:  master.out                     0.0 KB
> Log files:  nginx_access.log               0.0 KB
> Log files:  nginx_error.log                2.0 KB
> Log files:  Total size                     10.97 MB
> 
> Parsing Blitz-0.log:[line:106] => Server restarted <=
> Parsing Blitz-0.log:[line:526] => Server restarted <=
> Parsing Blitz-0.log:[line:861] => Server restarted <=
> Parsing Blitz-0.log:[line:10275] => Server restarted <=
> 
> Environment:OMERO_HOME=/opt/OMERO/OMERO.server-Beta-4.3.3
> Environment:OMERO_NODE=(unset)
> Environment:OMERO_MASTER=(unset)
> Environment:PATH=/usr/kerberos/bin:/usr/bin:/bin:/opt/iRODS/current/clients/icommands/bin:/opt/iRODS/current/clients/fuse/bin:/home/omero/bin:/opt/OMERO/OMERO.server-Beta-4.3.3/bin:/home/omero/bin 
> Environment:ICE_HOME=/usr/share/Ice-3.3.1
> Environment:LD_LIBRARY_PATH=(unset)
> Environment:DYLD_LIBRARY_PATH=(unset)
> 
> OMERO data dir: '/data/OMERO'   Exists? True    Is writable? True
> OMERO.web status... [NOT STARTED]
> 
> 
> So OMERO.web is not starting, even though there is no error:
> 
> [omero at lmu-omero2 ~]$ omero web start
> Starting OMERO.web... Removed stale /opt/OMERO/OMERO.server-Beta-4.3.3/var/django.pid
> [OK]

is anything listening to port 4080?

# netstat -ntlp |grep 4080 


> [omero at lmu-omero2 ~]$
> [omero at lmu-omero2 ~]$ omero web status
> OMERO.web status... [NOT STARTED]
> 
> Where to look next?
> 

I'm assuming nothing of interest in $OMERO_HOME/var/log/OMEROweb*?

Are you running under selinux by chance?

# sestatus


> Thanks,
> Harri
> 
> On 19/03/12 17:39, Harri Jäälinoja wrote:
>> 
>> Hi all,
>> I have problems setting up OMERO.web. I decided to go for nginx so that
>> I don't have to worry about compiling the FastCGI module.
>> 
>> System info:
>> - I am using OMERO 4.3.3.
>> - OS: Red Hat Enterprise Linux Server release 5.8 (Tikanga)
>> - nginx 0.8.55-1
>> [root at lmu-omero2 nginx]# yum list |grep nginx
>> nginx.x86_64 0.8.55-1.el5 installed
>> collectd-nginx.x86_64 4.10.3-1.el5 epel
>> 
>> 
>> The error messages:
>> 
>> On the browser I get
>> "502 Bad Gateway".
>> 
>> I log file I get this:
>> 2012/03/19 17:08:34 [error] 2062#0: *5 upstream sent unsupported FastCGI
>> protocol version: 60 while reading response header from upstream,
>> client: 128.214.89.14, server: _, request: "GET / HTTP/1.1", upstream:
>> "fastcgi://0.0.0.0:4080", host: "lmu-omero2.biocenter.helsinki.fi"
>> 
>> In OMEROweb.log I have:
>> Mon, 19 Mar 2012 17:10:13 root INFO Application Starting...
>> 
>> 
>> This is the configuration:
>> 
>> [omero at lmu-omero2 ~]$ omero config get|grep web
>> omero.web.application_host=http://lmu-omero2.biocenter.helsinki.fi:80/
>> omero.web.application_server=fastcgi-tcp
>> omero.web.email_host=lmu-omero2.biocenter.helsinki.fi
>> omero.web.server_email=omero at lmu-omero2.biocenter.helsinki.fi
>> 
>> [omero at lmu-omero2 ~]$ omero web config nginx

This generated config is more designed around running a separate nginx instance as a non-priviledged user on a different port.

That config would need to be tweaked a little to run as a root instance.

As far as avoiding compiling fastcgi, if you add the rpmforge repositories (http://wiki.centos.org/AdditionalResources/Repositories/RPMForge those are centos instructions but are true for RHEL as well) it has fastcgi packages.

But nginx's configuration is secondary to why omero web doesn't seem to be starting correctly.


>> pid /opt/OMERO/OMERO.server-Beta-4.3.3/var/pid.nginx;
>> error_log /opt/OMERO/OMERO.server-Beta-4.3.3/var/log/nginx_error.log;
>> worker_processes 5;
>> working_directory /opt/OMERO/OMERO.server-Beta-4.3.3/var;
>> 
>> events {
>> worker_connections 1024;
>> }
>> 
>> 
>> http {
>> access_log /opt/OMERO/OMERO.server-Beta-4.3.3/var/log/nginx_access.log;
>> include /opt/OMERO/OMERO.server-Beta-4.3.3/etc/mime.types;
>> default_type application/octet-stream;
>> client_body_temp_path /opt/OMERO/OMERO.server-Beta-4.3.3/var/nginx_tmp;
>> 
>> keepalive_timeout 65;
>> 
>> server {
>> listen 80;
>> server_name _;
>> fastcgi_temp_path /opt/OMERO/OMERO.server-Beta-4.3.3/var/nginx_tmp;
>> proxy_temp_path /opt/OMERO/OMERO.server-Beta-4.3.3/var/nginx_tmp;
>> 
>> # weblitz django apps serve media from here
>> location /appmedia {
>> alias /opt/OMERO/OMERO.server-Beta-4.3.3/lib/python/omeroweb/media;
>> }
>> 
>> # django's admin media
>> location /media {
>> alias
>> /opt/OMERO/OMERO.server-Beta-4.3.3/lib/python/omeroweb/media/django_admin_media;
>> 
>> }
>> 
>> location / {
>> if (-f /opt/OMERO/OMERO.server-Beta-4.3.3/var/maintenance.html) {
>> error_page 503 /maintenance.html;
>> return 503;
>> }
>> fastcgi_pass 0.0.0.0:4080;
>> fastcgi_param PATH_INFO $fastcgi_script_name;
>> fastcgi_param REQUEST_METHOD $request_method;
>> fastcgi_param QUERY_STRING $query_string;
>> fastcgi_param CONTENT_TYPE $content_type;
>> fastcgi_param CONTENT_LENGTH $content_length;
>> fastcgi_param SERVER_NAME $server_name;
>> fastcgi_param SERVER_PROTOCOL $server_protocol;
>> fastcgi_param SERVER_PORT $server_port;
>> fastcgi_pass_header Authorization;
>> fastcgi_intercept_errors on;
>> fastcgi_read_timeout 300;
>> }
>> 
>> location /maintenance.html {
>> root /opt/OMERO/OMERO.server-Beta-4.3.3/var;
>> }
>> 
>> }
>> 
>> }
>> 
>> There may be some issue with permissions:
>> [omero at lmu-omero2 ~]$ ls -l /opt/OMERO/OMERO.server-Beta-4.3.3/var
>> total 24
>> -rw-r--r-- 1 omero omero 5 Mar 19 17:10 django.pid
>> drwxrwxr-x 2 omero omero 4096 Mar 16 17:33 log
>> drwxrwxr-x 5 omero omero 4096 Mar 14 17:18 master
>> drwx------ 2 nginx root 4096 Mar 16 17:33 nginx_tmp
>> -rw-r--r-- 1 root root 5 Mar 19 13:20 pid.nginx
>> drwxrwxr-x 2 omero omero 4096 Mar 14 17:18 registry
>> 
>> 
>> [omero at lmu-omero2 ~]$ omero admin diagnostics
>> FATAL: Cannot access /opt/OMERO/OMERO.server-Beta-4.3.3/var/nginx_tmp, a
>> required file/directory for OMERO
>> 
>> What should I change?
>> 
>> Thanks in advance, best regards,
>> Harri

C


--
Chris MacLeod
ckm[at]glencoesoftware.com
Systems Administrator
Glencoe Software




More information about the ome-users mailing list