Page 1 of 1

Getting "upstream directive is not allowed here " error

PostPosted: Tue Apr 23, 2019 1:16 am
by tinat
Hello,

I am running OMERO 5.4.10 on Ubuntu 16.04 with nginx 1.10.3

I had started OMERO.server with the command: OMERO.server/bin/omero admin start
And OMERO.web had been configured with:

"OMERO.server/bin/omero config set omero.web.application_server wsgi-tcp"

And the nginx configuration generated with
OMERO.server/bin/omero web config nginx --http "$WEBPORT" > OMERO.server/etc/nginx/omero-nginx.conf

When I try to run nginx with the following command:
/usr/sbin/nginx -c /opt/omero/OMERO.server/etc/nginx/conf/omero-nginx.conf

I get the error:
nginx: [emerg] "upstream" directive is not allowed here in /opt/omero/OMERO.server/etc/nginx/conf/omero-nginx.conf:1

contents of omero-nginx.conf:

upstream omeroweb {
server 127.0.0.1:4080 fail_timeout=0;
}

server {
listen 8881;
server_name $hostname;

sendfile on;
client_max_body_size 0;

# maintenance page serve from here
location @maintenance {
root /opt/omero/OMERO.server/etc/templates/error;
try_files $uri /maintainance.html =502;
}

# weblitz django apps serve media from here
location /static {
alias /opt/omero/OMERO.server/lib/python/omeroweb/static;
}

location @proxy_to_app {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_buffering off;

proxy_pass http://omeroweb;
}

location / {

error_page 502 @maintenance;
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}

}

Re: Getting "upstream directive is not allowed here " error

PostPosted: Tue Apr 23, 2019 9:46 am
by wmoore
When running nginx, passing the config with -c as described https://docs.openmicroscopy.org/omero/5 ... using-wsgi you'll need to use the developer config generated via

Code: Select all
$ bin/omero web config nginx-development


To run in production, see https://docs.openmicroscopy.org/omero/5 ... ring-nginx

Hope that helps,

Will.

Re: Getting "upstream directive is not allowed here " error

PostPosted: Tue Apr 23, 2019 4:56 pm
by tinat
Hi Will,

Thanks! That worked!
Best, Tina