I just got an Yellow Dog Linux (YDL) up and running on Amazon EC2. YDL is based on Red Hat. The installation tool is called “yum”. It is similar to debians “apt-get” tool, but it is based on RPMs.
Anyway. You can install nginx via yum with this command:
sudo yum install nginx
But this is not the newest version. If you want the newest version you should install it from the source code. But at first you need to install some additional tools.
sudo yum install gcc
sudo yum install pcre
sudo yum install pcre-devel
sudo yum install zlib
sudo yum install zlib-devel
sudo yum install make
Now you can download the newest version with weget from the nginx page: http://wiki.nginx.org/Install
After the download you should unpack the *tar.gz file und navigate into the directory. Now you can install it with this 3 commands:
sudo ./configure
sudo make
sudo make install
If everything works fine it is installed here:
/usr/local/nginx/
Now you can add “/usr/local/nginx/sbin” to your PATH or you just create a symlink in “/usr/bin”
cd /usr/bin
ln -s /usr/local/nginx/sbin/nginx
For security reason you should create a nginx group.
sudo useradd -s /sbin/nologin -r nginx
sudo usermod -a -G nginx <USERNMAE>
And you should have a place where you deploy your webapps.
sudo mkdir /var/www
sudo chgrp -R nginx /var/www
sudo chmod -R 755 /var/www
Now you can start nginx with this command:
sudo nginx
And stop it with this command:
sudo nginx -s stop