Installing nginx on centos should be straightforward

I have set up a virtual server with a LAMP stack (Centos 6.3) and am now
trying to install nginx to use as a proxy server. I have been told to
download from sudo rpm -Uvh
http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
and
have done so prior to trying to install nginx. However, something was
wrong
with this because when I tried to install nginx (sudo yum install
nginx),
there were a number of packages that were skipped due to dependency
problems. When I tried to start nginx, it could not find the files.

Given that nginx is a well-used server, this has to be easier than what
I am
encountering. Does anyone know the correct commands to set this up so
that
nginx can install?

Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236254#msg-236254

On Sat, 2013-02-16 at 17:27 -0500, mottwsc wrote:

encountering. Does anyone know the correct commands to set this up so that
nginx can install?

Thanks.
It is. If you’re going to install nginx from a repo, why not use theirs?

rpm -Uvh
http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

then

yum install nginx

( next question… why only use it as a proxy server? )

Steve

Thanks for the suggestion, Steve. I was working from that angle before
based on advice from a person at my hosting company and had used the
nginx
repo. I am addressing three points in response. Any
suggestions/thoughts
from you and/or others are appreciated.

(1) Reason for nginx and apache:
The reason I am planning to use nginx on the front end and apache on the
back end (instead of nginx for all of it) is that I’ve read in an
article
that apache’s power and nginx’s speed are well known. But apache is hard
on
server memory, and nginx (while great at static files) needs the help of
php-fpm or similar modules for dynamic content. The article goes on to
recommend that you combine the two web servers, with nginx as static web
server front and apache processing the back end. My application has a
lot
of dynamic content including videos, and makes use of ajax and jquery.

What are your and others thoughts on the nginx / apache / both question?

(2) Your command to get the nginx repo:
when I tried this again with your specific command, I got:
[[email protected] ~]$ rpm -Uvh
http://nqinx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Retrieving
http://nqinx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
curl: (6) Couldn’t resolve host ‘nqinx.org
error: skipping
http://nqinx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

  • transfer failed

(3) Past attempt at installing nginx in a similar way:
I’m pasting the output from this past attempt in case anyone can see
what
might be missing or wrong…
[[email protected] ~]$ wget
http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
–2013-02-17 01:35:23–
http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Resolving nginx.org… 206.251.255.63
Connecting to nginx.org|206.251.255.63|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 4311 (4.2K) [application/x-redhat-package-manager]
Saving to: `nginx-release-centos-6-0.el6.ngx.noarch.rpm’

100%[======================================>] 4,311 --.-K/s in 0.07s

2013-02-17 01:35:23 (61.7 KB/s) -
`nginx-release-centos-6-0.el6.ngx.noarch.rpm’ saved [4311/4311]

[[email protected] ~]$ rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
warning: nginx-release-centos-6-0.el6.ngx.noarch.rpm: Header V4 RSA/SHA1
Signature, key ID 7bd9bf62: NOKEY
error: can’t create transaction lock on /var/lib/rpm/.rpm.lock
(Permission
denied)
[[email protected] ~]$ sudo yum install nginx
[sudo] password for m:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.lga7.us.voxel.net
  • epel: epel.mirror.constant.com
  • extras: mirror.symnds.com
  • updates: mirror.team-cymru.org
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package nginx.x86_64 0:0.8.55-2.el5 will be installed
    –> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libxslt.so.1()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libssl.so.6()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libgd.so.2()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libexslt.so.0()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libcrypto.so.6()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Processing Dependency: libGeoIP.so.1()(64bit) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Running transaction check
    —> Package GeoIP.x86_64 0:1.4.8-1.el5 will be installed
    —> Package gd.x86_64 0:2.0.35-10.el6 will be installed
    –> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libpng12.so.0()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libjpeg.so.62()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libfreetype.so.6()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libfontconfig.so.1()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libXpm.so.4()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    –> Processing Dependency: libX11.so.6()(64bit) for package:
    gd-2.0.35-10.el6.x86_64
    —> Package libxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed
    —> Package nginx.x86_64 0:0.8.55-2.el5 will be installed
    –> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package:
    nginx-0.8.55-2.el5.x86_64
    —> Package openssl098e.x86_64 0:0.9.8e-17.el6.centos.2 will be
    installed
    –> Running transaction check
    —> Package fontconfig.x86_64 0:2.8.0-3.el6 will be installed
    —> Package freetype.x86_64 0:2.3.11-14.el6_3.1 will be installed
    —> Package libX11.x86_64 0:1.3-2.el6 will be installed
    –> Processing Dependency: libX11-common = 1.3-2.el6 for package:
    libX11-1.3-2.el6.x86_64
    –> Processing Dependency: libxcb.so.1()(64bit) for package:
    libX11-1.3-2.el6.x86_64
    —> Package libXpm.x86_64 0:3.5.8-2.el6 will be installed
    —> Package libjpeg.x86_64 0:6b-46.el6 will be installed
    —> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
    —> Package nginx.x86_64 0:0.8.55-2.el5 will be installed
    –> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Running transaction check
    —> Package libX11-common.noarch 0:1.3-2.el6 will be installed
    —> Package libxcb.x86_64 0:1.5-1.el6 will be installed
    –> Processing Dependency: libXau.so.6()(64bit) for package:
    libxcb-1.5-1.el6.x86_64
    —> Package nginx.x86_64 0:0.8.55-2.el5 will be installed
    –> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Running transaction check
    —> Package libXau.x86_64 0:1.0.5-1.el6 will be installed
    —> Package nginx.x86_64 0:0.8.55-2.el5 will be installed
    –> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package:
    nginx-0.8.55-2.el5.x86_64
    –> Finished Dependency Resolution
    Error: Package: nginx-0.8.55-2.el5.x86_64 (epel)
    Requires: perl(:MODULE_COMPAT_5.8.8)
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest
    [[email protected] ~]$ sudo /etc/init.d/nginx start
    sudo: /etc/init.d/nginx: command not found

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236259#msg-236259

Installing as root allowed the method under (3) to work. Still have a
problem starting nginx, but I’ll see if I can work thru that. I would
appreciate comments on item (1) though from anyone’s experience.

Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236263#msg-236263

what was the article that you read?
you should probably do your own tests to work out the fastest way to do
it if you really need as many dynamic requests as possible
My thoughts at this point (after using nginx for 3+ years) is that I
would avoid using apache - KISS!

Here’s the article:

https://www.digitalocean.com/community/articles/how-to-configure-nginx-as-a-front-end-proxy-for-apache

I agree that if I could do it all with one web server, it would be
simpler/cleaner. I’m just not sure based on what is in this article
that
nginx will be fine alone

  • “nginx (great at static files) needs the help of php-fpm or similar
    modules for dynamic content”.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236265#msg-236265

Hi
Many (MANY) people use php-fpm and it’s fine
If you really need extra performance you should test it yourself on your
own application (not hard to do) and see if proxying to apache actually
gives any benefit

It looks like PHP-FPM comes with PHP 5.3.3, so I should have it already
for
use with nginx. Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236268#msg-236268

Thanks for catching that type, GreenGecko.

I was able to get nginx installed, but at this point it won’t start
(bind,
that is).

Is this problem familiar to anyone?

the end of the installation…
Installed:
nginx.x86_64 0:1.2.7-1.el6.ngx

Complete!

trying to start nginx…
[[email protected] ~]# /etc/init.d/nginx start
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address
already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236273#msg-236273

On Sun, 2013-02-17 at 17:09 -0500, mottwsc wrote:

nginx: [emerg] still could not bind()
[FAILED]

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236273#msg-236273

Yes. You’ve already got something running on port 80… either your old
nginx, or apache.

Error messages are there to help you…

Steve

Sent from my iPad

On 18/02/2013, at 2:42 AM, “mottwsc” [email protected] wrote:

php-fpm or similar modules for dynamic content. The article goes on to
recommend that you combine the two web servers, with nginx as static web
server front and apache processing the back end. My application has a lot
of dynamic content including videos, and makes use of ajax and jquery.

What are your and others thoughts on the nginx / apache / both question?
I use nginx and PHP-fpm without any problems. I only use apache when
forced.

http://nqinx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

  • transfer failed

Try nginx.org, not nqinx.org

HTTP request sent, awaiting response… 200 OK
Signature, key ID 7bd9bf62: NOKEY
error: can’t create transaction lock on /var/lib/rpm/.rpm.lock (Permission
denied)
This failed. You need to use sudo for this as well. After fixing this,
you’ll be installing 1.2.7, not 0.8.

OK, Steve - thanks for your help.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,236254,236317#msg-236317

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs