Friday, 29 December 2017

Configure Nginx server as a reverse proxy in RHEL7 / CentOS

INSTALLATION OF Nginx :-

[root@station108 ~]# rpm -ivh http://nginx.org/packages/rhel/7/noarch/RPMS/nginx-release-rhel-7-0.el7.ngx.noarch.rpm

[root@station108 ~]# yum install nginx-1.12.1 -y

second method:-

[root@station108 ~]# vim /etc/yum.repos.d/nginx.repo

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

[root@station108 ~]# yum repolist all

[root@station108 ~]# rpm -qc nginx

/etc/logrotate.d/nginx
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug

 [root@station108 ~]# cp /etc/nginx/conf.d/default.conf  /etc/nginx/conf.d/default.conf.bak

[root@station108 ~]# vim /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  station108.example.com;


    location / {
       # root   /usr/share/nginx/html;
        #index  index.html index.htm;

        proxy_pass   http://192.168.10.105 ;   

            }

[root@station108 ~]#  systemctl restart nginx

[root@station108 ~]#  systemctl enable nginx




No comments:

Post a Comment