CENTOS7.2 NGINX 反向代理 APACHE

 2022-12-12
1、添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令(没有换行):
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2、安装

yum install -y nginx
3、开机启动。

systemctl enable nginx.service
4、启动。
systemctl start nginx.service
5、配置:

vi /etc/nginx/conf.d/default.conf
location / {
    proxy_pass    http://192.168.1.4/;
    proxy_redirect default ;
    proxy_set_header   Host   $host;
    proxy_set_header   Referer $http_referer;
    proxy_set_header   Cookie $http_cookie;
    proxy_set_header   X-Real-IP  $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 10m;
}