Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CENTOS installs nginx and configures reverse proxy

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Installation

Yum install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc gcc-c++ autoconf automake

. / configure-prefix=/usr/local/nginx-with-http_stub_status_module-with-http_ssl_module-with-http_realip_module

Make & & make install

Configure domain name and reverse proxy

1) add a resolution record to Aliyun for domain names that need to be proxied, such as demo.example.com resolution to the corresponding ip.

2) add corresponding resolution configuration to nginx.conf

Upstream tomcat_demo_servers {

Server 192.168.1.101:8080

Server 192.168.1.101:9080

}

Server {

Listen 80

Server_name demo.example.com

Location /

{

Proxy_pass http://tomcat_demo_servers;

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) at the end of configuration, accessing demo.example.com in the browser can be forwarded to tomcat_demo_servers by nginx.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report