Changes between Initial Version and Version 1 of Ticket #691


Ignore:
Timestamp:
03/03/14 14:29:45 (3 years ago)
Author:
chris
Comment:

The instructions at:

Are for Apache, this pages is linked for non-Apache servers:

And that page links to:

Which redirects to:

And from there the instructions can be found:

Following these instructions:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
  Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.C1h2y7GLRv --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
  gpg: requesting key AC40B2F7 from hkp server keyserver.ubuntu.com
  gpg: key AC40B2F7: public key "Phusion Automated Software Signing (Used by automated tools to sign software packages) <auto-software-signing@phusion.nl>" imported
  gpg: no ultimately trusted keys found
  gpg: Total number processed: 1
  gpg:               imported: 1  (RSA: 1)
apt-get install apt-transport-https ca-certificates
  The following NEW packages will be installed:
    apt-transport-https

Then /etc/apt/sources.list.d/passenger.list was created, containing:

# http://www.modrails.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu
# /trac/ticket/691
# Debian 7
deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main

Then:

chown root:root /etc/apt/sources.list.d/passenger.list
chmod 600 /etc/apt/sources.list.d/passenger.list

Check that we are running nginx-extras:

aptitude search nginx | grep ^i
  i   nginx                           - small, powerful, scalable web/proxy server
  i   nginx-common                    - small, powerful, scalable web/proxy server
  i   nginx-full                      - nginx web/proxy server (standard version) 

We are not so:

aptitude install nginx-extras 
  The following NEW packages will be installed:
    nginx-extras{b} 
  0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  Need to get 601 kB of archives. After unpacking 1347 kB will be used.
  The following packages have unmet dependencies:
   nginx-full : Conflicts: nginx-extras but 1.2.1-2.2+wheezy2 is to be installed.
   nginx-extras : Depends: nginx-common (= 1.2.1-2.2+wheezy2) but 1.4.4-1~bpo70+1 is installed.
                  Depends: liblua5.1-0 but it is not going to be installed.
                  Depends: libperl5.14 (>= 5.14.2) but it is not going to be installed.
                  Conflicts: nginx-full but 1.4.4-1~bpo70+1 is installed.
  The following actions will resolve these dependencies:
  
       Keep the following packages at their current version:
  1)     nginx-extras [Not Installed]                       
  
  Accept this solution? [Y/n/q/?] n
  The following actions will resolve these dependencies:
  
       Remove the following packages:                                                        
  1)     nginx                                                                               
  2)     nginx-full                                                                          
  
       Install the following packages:                                                       
  3)     liblua5.1-0 [5.1.5-4 (stable)]                                                      
  4)     libperl5.14 [5.14.2-21+deb7u1 (stable)]                                             
  
       Downgrade the following packages:                                                     
  5)     nginx-common [1.4.4-1~bpo70+1 (now, wheezy-backports) -> 1.2.1-2.2+wheezy2 (stable)]

Oh dear...

We want to install this package:

So /etc/apt/preferences.d/backports.pref was edited to add nginx-extras:

Package: nginx nginx-common nginx-full nginx-extras
Pin: release o=backports
Pin-Priority: 990

And then:

aptitude update; aptitude install nginx-extras
  The following NEW packages will be installed:
    nginx-extras{b} 
  The following packages are RECOMMENDED but will NOT be installed:
    passenger 
  0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  Need to get 1009 kB of archives. After unpacking 2592 kB will be used.
  The following packages have unmet dependencies:
   nginx-full : Conflicts: nginx-extras but 1:1.4.4-2.4.0.37~wheezy1 is to be installed.
   nginx-extras : Depends: nginx-common (= 1:1.4.4-2.4.0.37~wheezy1) but 1.4.4-1~bpo70+1 is installed.
                  Depends: liblua5.1-0 but it is not going to be installed.
                  Depends: libperl5.14 (>= 5.14.2) but it is not going to be installed.
                  Conflicts: nginx-full but 1.4.4-1~bpo70+1 is installed.
  The following actions will resolve these dependencies:
  
       Keep the following packages at their current version:
  1)     nginx-extras [Not Installed]                       
  

That isn't exactly what we want, so:

aptitude install liblua5.1-0 libperl5.14  

Try again:

aptitude install nginx-extras
The following NEW packages will be installed:
  nginx-extras{b} 
The following packages are RECOMMENDED but will NOT be installed:
  passenger 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1009 kB of archives. After unpacking 2592 kB will be used.
The following packages have unmet dependencies:
 nginx-full : Conflicts: nginx-extras but 1:1.4.4-2.4.0.37~wheezy1 is to be installed.
 nginx-extras : Depends: nginx-common (= 1:1.4.4-2.4.0.37~wheezy1) but 1.4.4-1~bpo70+1 is installed.
                Conflicts: nginx-full but 1.4.4-1~bpo70+1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     nginx-extras [Not Installed]                       

But we want nginx-extras (1.4.4-1~bpo70+1) so:

install nginx-extras=1.4.4-1~bpo70+1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  nginx-doc
The following packages will be REMOVED:
  nginx nginx-full
The following NEW packages will be installed:
  nginx-extras
0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
Need to get 664 kB of archives.
After this operation, 391 kB of additional disk space will be used.
Do you want to continue [Y/n]? 

That's more like it!

Install and restart Nginx:

/etc/init.d/nginx start
  [ ok ] Starting nginx: nginx.

Now back to the instructions and:

aptitude install passenger
  The following NEW packages will be installed:
    crash-watch{a} gdb{a} gdbserver{a} libcurl3{a} libev4{a} libpython2.7{a} passenger passenger-dev{a} 
    passenger-doc{a} ruby-daemon-controller{a} ruby-rack{a} 
  0 packages upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
  Need to get 12.5 MB of archives. After unpacking 51.1 MB will be used.

This created /etc/nginx/nginx.conf.dpkg-dist, so comparing this with the live config:

cd /etc/nginx
diff nginx.conf nginx.conf.dpkg-dist | vim -
  3c3
  < pid /var/run/nginx.pid;
  ---
  > pid /run/nginx.pid;
  19c19
  <       keepalive_timeout 240;
  ---
  >       keepalive_timeout 65;
  23,24d22
  <       # needed for the redirects
  <       server_names_hash_max_size 2048;
  29,32c27
  <       #default_type application/octet-stream;
  <       #default_type text/plain; 
  <         default_type text/html;
  <         charset utf-8;
  ---
  >       default_type application/octet-stream;
  41,51c36,56
  <       # geoip
  <       # http://piwik.org/faq/how-to/#faq_166
  <       geoip_country  /etc/nginx/geoip/GeoIP.dat;
  <       geoip_city     /etc/nginx/geoip/GeoIPCity.dat;
  < 
  <         # ssl
  <       ssl_session_cache shared:SSL:10m;
  < 
  <       ## FastCGI cache zone definition.
  <       # https://github.com/perusio/piwik-nginx
  <       include fastcgi_cache_zone.conf;
  ---
  >       ##
  >       # Gzip Settings
  >       ##
  > 
  >       gzip on;
  >       gzip_disable "msie6";
  > 
  >       # gzip_vary on;
  >       # gzip_proxied any;
  >       # gzip_comp_level 6;
  >       # gzip_buffers 16 8k;
  >       # gzip_http_version 1.1;
  >       # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  > 
  >       ##
  >       # nginx-naxsi config
  >       ##
  >       # Uncomment it if you installed nginx-naxsi
  >       ##
  > 
  >       #include /etc/nginx/naxsi_core.rules;
  53,54c58,65
  <       ## Include the cache map to decide when or not when to cache.
  <       include map_cache_piwik.conf;
  ---
  >       ##
  >       # nginx-passenger config
  >       ##
  >       # Uncomment it if you installed nginx-passenger
  >       ##
  >       
  >       #passenger_root /usr;
  >       #passenger_ruby /usr/bin/ruby;

The key differences here are:

>       #passenger_root /usr;
>       #passenger_ruby /usr/bin/ruby;

So these lines were added and Ngnix restarted and to see that passanger is running:

passenger-memory-stats
  Version: 4.0.37
  Date   : 2014-03-03 13:26:04 +0000
  ------------- Apache processes -------------
  *** WARNING: The Apache executable cannot be found.
  Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.
  
  
  ---------- Nginx processes -----------
  PID    PPID   VMSize    Private  Name
  --------------------------------------
  25430  1      158.3 MB  0.2 MB   nginx: master process /usr/sbin/nginx
  25433  25430  158.3 MB  1.5 MB   nginx: worker process
  25436  25430  158.3 MB  1.3 MB   nginx: worker process
  25440  25430  158.3 MB  1.1 MB   nginx: worker process
  25443  25430  158.3 MB  0.5 MB   nginx: worker process
  ### Processes: 5
  ### Total private dirty RSS: 4.67 MB
  
  
  --- Passenger processes ---
  
  ### Processes: 0
  ### Total private dirty RSS: 0.00 MB

According to the instructions:

You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerWatchdog, PassengerHelperAgent).

But we don't... so, looking at:

The first suggestion is to check the /var/log/nginx/error.log and we have this in it:

2014/03/03 13:25:26 [emerg] 27589#0: unknown directive "passenger_root" in /etc/nginx/nginx.conf:70

One suggestion is to delete all the ngnix config and reinstall:

Also:

I think the issues might be cause by the fact that we are running Ngnix from backports, for now I have commented out these directoves:

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

Switching to the Wheezy version of Nginx (1.2 rather than 1.4, so we will lose things like spdy.

mv /etc/apt/preferences.d/backports.pref /etc/apt/backports.pref.bak
mv /etc/apt/sources.list.d/backports.list /etc/apt/backports.list.bak
aptitude update
apt-get install nginx-extras=1.2.1-2.2+wheezy2 nginx-common=1.2.1-2.2+wheezy2
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  The following package was automatically installed and is no longer required:
    init-system-helpers
  Use 'apt-get autoremove' to remove it.
  The following packages will be DOWNGRADED:
    nginx-common nginx-extras
  0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 0 not upgraded.
  Need to get 675 kB of archives.
  After this operation, 145 kB disk space will be freed.

  Configuration file `/etc/nginx/nginx.conf'
   ==> Modified (by you or by a script) since installation.
   ==> Package distributor has shipped an updated version.
     What would you like to do about it ?  Your options are:
      Y or I  : install the package maintainer's version
      N or O  : keep your currently-installed version
        D     : show the differences between the versions
        Z     : start a shell to examine the situation
   The default action is to keep your current version.
  *** nginx.conf (Y/I/N/O/D/Z) [default=N] ? N

  Configuration file `/etc/nginx/fastcgi_params'
   ==> Modified (by you or by a script) since installation.
   ==> Package distributor has shipped an updated version.
     What would you like to do about it ?  Your options are:
      Y or I  : install the package maintainer's version
      N or O  : keep your currently-installed version
        D     : show the differences between the versions
        Z     : start a shell to examine the situation
   The default action is to keep your current version.
  *** fastcgi_params (Y/I/N/O/D/Z) [default=N] ? N

On restarting Nginx we have these errors in the logs:

2014/03/03 14:11:28 [alert] 768#0: epoll_ctl(1, 0) failed (1: Operation not permitted)
2014/03/03 14:11:28 [alert] 768#0: failed to register channel handler while initializing push module worker (1: Operation not permitted)
2014/03/03 14:11:28 [alert] 763#0: cache manager process 768 exited with fatal code 2 and cannot be respawned
2014/03/03 14:11:28 [alert] 769#0: epoll_ctl(1, 0) failed (1: Operation not permitted)
2014/03/03 14:11:28 [alert] 769#0: failed to register channel handler while initializing push module worker (1: Operation not permitted)

But the server is running...

So the passenger config was uncommented in /etc/nginx/nginx.conf:

        passenger_root /usr;
        passenger_ruby /usr/bin/ruby;

But then Nginx wouldn't restart:

/etc/init.d/nginx restart
  Restarting nginx: nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/nginx.conf:70
  nginx: configuration file /etc/nginx/nginx.conf test failed

So those lines were commented out again.

Uninstalling and reinstalling was tried:

aptitude remove passenger passenger-dev passenger-doc
  The following packages will be REMOVED:  
    crash-watch{u} init-system-helpers{u} libcurl3{u} libev4{u} passenger passenger-dev passenger-doc 
    ruby-daemon-controller{u} ruby-rack{u} 
  0 packages upgraded, 0 newly installed, 9 to remove and 2 not upgraded.
  Need to get 0 B of archives. After unpacking 41.1 MB will be freed.
  Do you want to continue? [Y/n/?] Y

aptitude install passenger passenger-dev passenger-doc
  The following NEW packages will be installed:
    crash-watch{a} libcurl3{a} libev4{a} passenger passenger-dev passenger-doc 
    ruby-daemon-controller{a} ruby-rack{a} 
  0 packages upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
  Need to get 0 B/8679 kB of archives. After unpacking 41.0 MB will be used.
  Do you want to continue? [Y/n/?] y

And the config was uncommented and tested:

/etc/init.d/nginx configtest
  Testing nginx configuration: nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/nginx.conf:70
  nginx: configuration file /etc/nginx/nginx.conf test failed

So one way forward would be to:

  1. Backup /etc/nginx:
mkdir /root/nginx
rsync -av /etc/nginx /root/nginx
  1. Uninstall and delete the config:
aptitude remove nginx-extras nginx-common passenger passenger-dev passenger-doc
rm -rf /etc/nginx
  1. Reinstall:
aptitude install nginx-extras nginx-common passenger passenger-dev passenger-doc
  1. Backup the new config and reinstall the old config:
/etc/init.d/nginx stop
mv /etc/nginx /root/nginx.new
mkdir /etc/nginx
rsync -av /root/nginx /etc/nginx

Then diff the configs to try to find the differences.

This would be best done late at night when less people are using sites on the server, I'll try to do this tonight.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #691

    • Property Add Hours to Ticket changed from 0.0 to 2.0
    • Property Status changed from new to accepted
    • Property Total Hours changed from 0.0 to 2.0
  • Ticket #691 – Description

    initial v1  
    11The http://patterns.transitionresearchnetwork.org/ site is running using a development set up and the webrick server falls over every now and then, so the plan is to upgrade to a production style setup. 
     2 
     3References: 
     4 
     5* trac:ticket/635 webrick server problems 
     6* wiki:TransitionResearchWagn documentation 
     7* trac:ticket/561 the last install 
     8* http://wagn.org/installation 
     9