unknown directive "upstream" in /etc/nginx/sites-enabled/atom:1

1,445 views
Skip to first unread message

Pål Mjørlund

unread,
Oct 23, 2015, 5:14:20 AM10/23/15
to ICA-AtoM Users
Hi. I am setting up an AtoM server for the first time, using AtoM 2.2 on Ubuntu 14.04 LTS.
I've tried to follow the install instructions in the admin manual and have done all the installations except the ones for Apache.
When I disable the AtoM site instructions in NGINX the web server do start and serves the installation success page.
But if I do add the Nginx server configurations for Atom (as copied from the installation manual) the server fails with one line in the error.log:
 
2015/10/23 10:29:10 [emerg] 2516#0: unknown directive "upstream" in /etc/nginx/sites-enabled/atom:1
 
I don't know what to look for. What am I missing here?
 
The following packages has been installed:
  mysql-server-5.5   5.5.44-0ubuntu0.14.04.1
  oracle-java8-installer
  elasticsearch 1.3.9
  ngingx 1.8.0-1+trusty1
  nginx-full 1.8.0-1+trusty1
  nginx-common A 1.8.0-1+trusty1
  php5-cli 5.5.9+dfsg-1ubuntu4.13
  php5-fpm 5.5.9+dfsg-1ubuntu4.13
  php5-curl 5.5.9+dfsg-1ubuntu4.13
  php5-mysql 5.5.9+dfsg-1ubuntu4.13
  php5-xsl 5.5.9+dfsg-1ubuntu4.13
  php5-json  1.3.2-2build1
  php5-ldap 5.5.9+dfsg-1ubuntu4.13
  php-apc 4.0.2-2build1
  php5-readline 5.5.9+dfsg-1ubuntu4.13
  gearman-job-server 1.0.6-3
 
  imagemagick ghostscript poppler-utils
  ffmpeg 7:2.5.3-1~14.04
 
 

David Juhasz

unread,
Oct 23, 2015, 1:27:40 PM10/23/15
to ica-ato...@googlegroups.com
Hi Pål,

I think PHP FPM needs to be configured for the upstream directive to work, have you done the PHP part of the install docs yet?

https://www.accesstomemory.org/en/docs/2.2/admin-manual/installation/linux/#php

You can double check that the PHP-FPM socket is running by doing:

ls /var/run/php5-fpm.atom.sock

You'll get a "No such file or directory" error if the socket is not running.

If the socket is working, you could try wrapping the entire contents of the /etc/nginx/sites-enabled/atom file in an http block, as shown below.  This is a pretty speculative though, as I don't think the http{} wrapper should be required.


Best regards,
David


http {
upstream atom {
  server unix:/var/run/php5-fpm.atom.sock;
}

server {

  listen 80;
  root /usr/share/nginx/atom;

  # http://wiki.nginx.org/HttpCoreModule#server_name
  # _ means catch any, but it's better if you replace this with your server
  # name, e.g. archives.foobar.com
  server_name _;

  client_max_body_size 72M;

  # http://wiki.nginx.org/HttpCoreModule#try_files
  location / {
    try_files $uri /index.php?$args;
  }

  location ~ /\. {
    deny all;
    return 404;
  }

  location ~* (\.yml|\.ini|\.tmpl)$ {
    deny all;
    return 404;
  }

  location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
    return 404;
  }

  location ~* /uploads/r/(.*)/conf/ {

  }

  location ~* ^/uploads/r/(.*)$ {
    include /etc/nginx/fastcgi_params;
    set $index /index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$index;
    fastcgi_param SCRIPT_NAME $index;
    fastcgi_pass atom;
  }

  location ~ ^/private/(.*)$ {
    internal;
    alias /usr/share/nginx/atom/$1;
  }

  location ~ ^/(index|qubit_dev)\.php(/|$) {
    include /etc/nginx/fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass atom;
  }

  location ~* \.php$ {
    deny all;
    return 404;
  }

}
}

--

David Juhasz
Director, AtoM Technical Services Artefactual Systems Inc. www.artefactual.com

--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at http://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/47d684c1-198e-4516-9ff0-1dcdf89cbd62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Pål Mjørlund

unread,
Oct 27, 2015, 5:25:22 AM10/27/15
to ICA-AtoM Users
Hello David. I've doublechecked the configurations.
I found that they had DOS linewrappings - so I changed them to Unix-version
 
The PHP-FPM socket is running
 
Added the http wrapper and restarted both PHP-FPM and nginx.
Both looks as they restart. PHP-FPM socket was checked OK
srw------- 1 www-data www-data 0 okt.  27 10:05 /var/run/php5-fpm.atom.sock
I also ran  php5-fpm --test
which returned:
[27-Oct-2015 10:11:58] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
 
By adding the http wrapper to the nginx configuration I get the error message on the wrapper instead of the upstream directive:
 
2015/10/27 10:06:37 [emerg] 6484#0: unknown directive "http" in /etc/nginx/sites-enabled/atom:1
 
I'm tempted to try Apache as webserver instead of nginx.....
 
Best regards
Pål

 

David Juhasz

unread,
Oct 27, 2015, 7:00:52 PM10/27/15
to ica-ato...@googlegroups.com
Hi Pål,

Now that you have the have the line breaks in UNIX format, have you tried removing the http wrapper again? You'll need to restart nginx or reload the config file (sudo service nginx reload).

You are welcome to use Apache of course, but we've had good results with nginx, so I'd encourage you to stick with it if possible. :)


Best regards,
David

--

David Juhasz
Director, AtoM Technical Services Artefactual Systems Inc. www.artefactual.com

--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at http://groups.google.com/group/ica-atom-users.

Pål Mjørlund

unread,
Oct 28, 2015, 11:05:20 AM10/28/15
to ICA-AtoM Users
I got the server up by copying all the nginx server directives directly into /etc/nginx/nginx.conf instead of using a separate file for the site. Further investigations showed me that the directives that I copied and stored in /etc/nginx/sites-available/atom had been stored with UTF-8 character set while all other directives was stored in ASCII
 
I've run into more problems and will probably start over on a blank server. Thanks for the help this far.
Reply all
Reply to author
Forward
0 new messages