Installing nginx on CentOS 6.4
The following commands can be used to quickly install nginx
on a server running CentOS 6
First, install the epel
repo
$ sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Install the remi
repo
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install nginx
and dependencies
$ sudo yum install nginx
Start the nginx HTTP server
$ sudo /etc/init.d/nginx start
You should now be able to open up a browser and visit the IP address of your server and see the default nginx landing page!
If you want to configure nginx and change the default number of workers, use the following command to edit the nginx.conf
file
$ sudo vi /etc/nginx/nginx.conf
If you want to configure the virtual hosts, use the following command to edit the default.conf
file
$ sudo vi /etc/nginx/conf.d/default.conf