Install NGINX server on CentOS 6/7

1

Create file /etc/yum.repos.d/nginx.repo and paste there the following content:

CentOS 6

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/6/$basearch/
gpgcheck=0
enabled=1

CentOS 7

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

Now you can install latest NGINX:

yum install nginx

If you're going to use NGINX with PHP then you should change the owner of the PHP session directory (which is usually located at /var/lib/php/session) to nginx:nginx

chown -R nginx:nginx /var/lib/php/session

Now everything's ready to work:

service nginx start

NGINX config is usually located at /etc/nginx/nginx.conf

Share this page:

See also how to:

How to install PHP FastCGI Process Manager (FPM) on CentOS 7
How to install PostgreSQL database server on Linux
A very simple steps to install PHP 7 on CentOS 7
How to install Java runtime environment on CentOS 7
How to install MySQL database server on CentOS 7