sudo yum install nginx
A. Install the EPEL repository (No package nginx available)
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
B. Change EPEL 5 version of the repo instead of 6
Error: Package: nginx-0.8.55-2.el5.x86_64 (epel)
Requires: perl(:MODULE_COMPAT_5.8.8)
vi /etc/yum.repos.d/epel.repo
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch
yum clean all
yum install munin --nogpgcheck
2. Configration
The default vhost is defined in the file /etc/nginx/conf.d/default.conf.
My case is setting up a reverse proxy to a Tomcat.
location /webportal {
proxy_pass http://localhost:8080/;
proxy_redirect http://localhost:8080/ http://$host:$server_port/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
3. Start
sudo /etc/init.d/nginx start
Reference :
http://articles.slicehost.com/2008/12/17/centos-installing-nginx-via-yum
http://gingerjoos.com/blog/linux/installing-jetty-on-centos