日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Nginx —— 用HTTP proxy module配置一个反向代理服务器

發(fā)布時間:2025/10/17 Nginx 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Nginx —— 用HTTP proxy module配置一个反向代理服务器 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

反響代理(reverse proxy)方式是指用代理服務(wù)器來接受Internet上的連接請求,然后將請求轉(zhuǎn)發(fā)給內(nèi)部網(wǎng)絡(luò)中的上游服務(wù)器,并將從上游服務(wù)器上得到的結(jié)果返回給Internet上請求連接的客戶端,此時代理服務(wù)器對外的表現(xiàn)就是一個Web服務(wù)器。充當(dāng)反響代理服務(wù)器也是nginx的一種常見的用法(反響代理服務(wù)器必須能夠大量處理并發(fā)請求)。

1》上游服務(wù)器地址 : 192.168.1.60

2》上游服務(wù)器被訪問文件:

[root@localhost html]# ip addr | grep 192inet 192.168.1.60/24 brd 192.168.1.255 scope global noprefixroute eno1inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0inet 192.168.135.1/24 brd 192.168.135.255 scope global vmnet8 [root@localhost html]# [root@localhost html]# pwd /var/www/html [root@localhost html]# cat index.html <html> <h1>This is 192.168.1.60!</h1> </html>

3》代理服務(wù)器地址: 192.168.1.210

4》 代理服務(wù)器配置conf:

[root@localhost conf]# cat nginx.conf | grep -v "#" worker_processes 1;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 8080;server_name localhost;location / {proxy_pass http://192.168.1.60;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}} }

5》啟動nginx服務(wù)器(找到nginx的二進(jìn)制文件):

[root@localhost conf]# /usr/local/nginx/sbin/nginx

6》客戶端測試地址: 192.168.1.93

打瀏覽器地址欄輸入: http://192.168.1.210:8080/

注意: 這里一定要加conf文件中監(jiān)聽的端口,否則http默認(rèn)監(jiān)聽80端口。

頁面顯示內(nèi)容:

[root@localhost html]# cat index.html <html> <h1>This is 192.168.1.60!</h1> </html>

7》測試中出現(xiàn)的問題:

<1>測試頁面出現(xiàn):An error occurred.

An error occurred.Sorry, the page you are looking for is currently unavailable. Please try again later.If you are the system administrator of this resource then you should check the error log for details.Faithfully yours, nginx.

解決方式:在1.60上執(zhí)行命令,開啟httpd服務(wù)

[root@localhost html]# service httpd start

?

注意:? Nginx —— nginx服務(wù)的基本配置(nginx.conf文件的詳解)

總結(jié)

以上是生活随笔為你收集整理的Nginx —— 用HTTP proxy module配置一个反向代理服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。