Changing atom root

79 views
Skip to first unread message

Doug Thomson

unread,
Oct 13, 2017, 1:48:22 PM10/13/17
to AtoM Users
Currently we have atom installed on the "root" of our nginx server.  I was wondering what changes needed to be made to have the url changed to "/atom".   I played around with the /etc/nginx/sites-available/atom but can't quite seem to get it working.    Is there other config files (php?) that need to be changed as well?

Thanks,

Doug

Dan Gillean

unread,
Oct 13, 2017, 2:52:05 PM10/13/17
to ICA-AtoM Users
Hi Doug, 

I'm treading into territory I don't know much about, but if you're talking about the URL you use in a webbrowser to access your site, I believe that will ultimately depend on your DNS A-record. I know from past experience setting up hosted clients that it is much less complicated to set up a DNS record that uses a subdomain (e.g. youratomsite.yourdomain.com) then it is to set up a separate AtoM site using a slash after the root domain (e.g. yourdomain/youratomsite) - I think it has to do with redirects, etc. 

I'll see if I can get input from some of our more knowledgeable team members :)

Cheers, 



Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/8dfba721-934b-4766-9ff3-89bfad607d11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Doug Thomson

unread,
Oct 15, 2017, 1:05:12 PM10/15/17
to AtoM Users
Thanks Dan,

Not quite what I was looking for.   I was thinking of running two copies on the same server so I would like to have one at /atom and another at /?????.   The "atom" site setup in nginx during the install sets atom as the '/" (root) for nginx.  If you hear anything back from your team that would be great.

Doug

Friesen, Darryl

unread,
Oct 15, 2017, 3:47:09 PM10/15/17
to AtoM Users

Doug, we are running 3 AtoM instances on both our test and prod servers.  Each is a Git checkout in /usr/share/nginx:


    /usr/share/nginx/collections

    /usr/share/nginx/items

    /usr/share/nginx/nunavut


Each has it's own PHP FPM config in /etc/php/7.0/fpm/pool.d/ named atom-collections.confatom-items.conf, and atom-nunavut.conf. Each of these files and each uses it's own socket, like this:


    listen = /run/php7.0-fpm.atom-collections.sock


Each also has it's own Gearman setup as well.



My /etc/nginx/sites-available/atom file looks like this:


Caveat: this is my first experience with nginx; I much prefer Apache as the config files make far more sense to me, so this could probably be improved.  It took me a long​ time to finally get this working, so I don't dare touch it anymore  :) 



upstream atom-collections {
  server unix:/run/php7.0-fpm.atom-collections.sock;
}
upstream atom-items {
  server unix:/run/php7.0-fpm.atom-items.sock;
}
upstream atom-nunavut {
  server unix:/run/php7.0-fpm.atom-nunavut.sock;
}

server {
  listen 80;
  root /var/www/html;

  log_not_found on;

  # _ 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;

  # Rewite/redirect requests for the root
  rewrite ^/$ http://scaa.sk.ca/sain-database/ redirect;
  rewrite ^/index.*$ http://scaa.sk.ca/sain-database/ redirect;

  location / {
    #try_files $uri /index.php?$args;
     try_files $uri $uri/ =404;
  }

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

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

  # AtoM collections
  location ^~ /collections {
    root /usr/share/nginx;

    location /collections {
      try_files $uri /collections/index.php?$args;
    }

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

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

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

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

    }

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

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

    location ~ ^/collections/(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-collections;
    }

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

  }
  # End of AtoM collections


  # AtoM items
  location ^~ /items {
    root /usr/share/nginx;

    #client_max_body_size 72M;

    location /items {
      try_files $uri /items/index.php?$args;
    }

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

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

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

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

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

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

    location ~ ^/items/(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-items;
    }

    location ~* \.php$ {
      deny all;
      return 404;
    }
  }
  # End of AtoM items


  # AtoM Nunavut
  location ^~ /nunavut {
    root /usr/share/nginx;

    #client_max_body_size 72M;

    location /nunavut {
      try_files $uri /nunavut/index.php?$args;
    }

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

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

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

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

    location ~* ^/uploads/r/(.*)$ {
      include /etc/nginx/fastcgi_params;
      set $index /nunavut/index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$index;
      fastcgi_param SCRIPT_NAME $index;
      fastcgi_pass atom-nunavut;
    }
    location ~ ^/nunavut/private/(.*)$ {
      internal;
      alias /usr/share/nginx/nunavut/$1;
    }

    location ~ ^/nunavut/(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-nunavut;
    }

    location ~* \.php$ {
      deny all;
      return 404;
    }
  }
  # End of AtoM nunavut

}


Hopefully that a bit of help


- Darryl


----------------------------------------------------------------------
Darryl Friesen, B.Sc., Programmer/Analyst    Darryl....@usask.ca
Library Systems & Information Technology,    http://library.usask.ca/
University of Saskatchewan Library
----------------------------------------------------------------------
"Go not to the Elves for counsel, for they will say both no and yes"





From: ica-ato...@googlegroups.com <ica-ato...@googlegroups.com> on behalf of Doug Thomson <dougth...@hotmail.com>
Sent: Sunday, October 15, 2017 11:05 AM
To: AtoM Users
Subject: [ica-atom-users] Re: Changing atom root
 
--
You received this message because you are subscribed to the Google Groups "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.

Doug Thomson

unread,
Oct 16, 2017, 9:47:39 AM10/16/17
to AtoM Users
Thanks Darryl,

That was very helpful.   I was able to get one site up and running.   Just the php and nginx so far.   Didn't get into memcache, elasticsarch, gearman  yet.    Only issue I have is php-fpm  seems to create only one .sock file under the /run directory.     The original php-fpm.conf file had "include=/etc/php/7.0/fpm/pool.d/*.conf.   I had the two site conf files in that directory.    I tried adding individual include options for each site but it still only seems to pickup one site.  

Doug

On Friday, October 13, 2017 at 2:48:22 PM UTC-3, Doug Thomson wrote:

Friesen, Darryl

unread,
Oct 16, 2017, 10:36:41 AM10/16/17
to AtoM Users

I kept the original /etc/php/7.0/fpm/php-fpm.conf as is, I think.


If you follow the Artefactual installation instructions, you will have created /etc/php/7.0/fpm/pool.d/atom.conf.  I copied that file to create an additional one for each of the AtoM instances I wanted to run.


    $ ls -l /etc/php/7.0/fpm/pool.d/

    -rw-r--r-- 1 root root  1837 Mar 15  2017 atom-collections.conf
    -rw-r--r-- 1 root root  1813 Mar  7  2017 atom.conf
    -rw-r--r-- 1 root root  1825 Mar  8  2017 atom-items.conf
    -rw-r--r-- 1 root root  1829 Mar 30  2017 atom-nunavut.conf

  I think the only change I made to the content of each was the "listen" line, so that each used it's own socket.


    $ grep "listen =" /etc/php/7.0/fpm/pool.d/*

    /etc/php/7.0/fpm/pool.d/atom-collections.conf:listen = /run/php7.0-fpm.atom-collections.sock
    /etc/php/7.0/fpm/pool.d/atom.conf:listen = /run/php7.0-fpm.atom.sock
    /etc/php/7.0/fpm/pool.d/atom-items.conf:listen = /run/php7.0-fpm.atom-items.sock
    ​/etc/php/7.0/fpm/pool.d/atom-nunavut.conf:listen = /run/php7.0-fpm.atom-nunavut.sock

Those sockets will then be used at the top of the nginx config:

    upstream atom-collections {
      server unix:/run/php7.0-fpm.atom-collections.sock;
    }
    upstream atom-items {
      server unix:/run/php7.0-fpm.atom-items.sock;
    }
    upstream atom-nunavut {
      server unix:/run/php7.0-fpm.atom-nunavut.sock;
    ​}

- Darryl



Sent: Monday, October 16, 2017 7:47 AM

To: AtoM Users
Subject: [ica-atom-users] Re: Changing atom root
--
You received this message because you are subscribed to the Google Groups "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 https://groups.google.com/group/ica-atom-users.

Doug Thomson

unread,
Oct 16, 2017, 12:20:42 PM10/16/17
to AtoM Users
Darryl,

Found the issue.   When I created the second config file I didn't change the pool name.   Once I changed the pool name from [atom] to another name both socket's were created.   Thanks for all you help.

Doug

On Friday, October 13, 2017 at 2:48:22 PM UTC-3, Doug Thomson wrote:

Dan Gillean

unread,
Oct 16, 2017, 5:40:59 PM10/16/17
to ICA-AtoM Users
Thanks so much for jumping in and sharing your solution, Darryl! Glad to hear you've got everything up and running now Doug; sorry for the initial misunderstanding. 

Cheers, 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory

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