Nginx域名轉發如何實現

nginx 介紹

nginx(“engine x”)是一款是由俄羅斯的程序設計師igor sysoev所開發高性能的 web和 反向代理 服務器,也是一個 imap/pop3/smtp 代理服務器。在高連接并發的情況下,nginx是apache服務器不錯的替代品。

nginx 安裝

1. 安裝編譯工具及庫文件

yum?-y?install?make?zlib?zlib-devel?gcc-c++?libtool?openssl?openssl-devel

2. 安裝 pcre

自行下載解壓源碼包 cd?安裝目錄 ./configure? make?&&?make?install//編譯安裝

3. 安裝 nginx

自行下載解壓源碼包 cd?安裝目錄 ./configure make make?install

nginx 常用命令

###?nginx/sbin?目錄下?###  ##?啟動nginx ./nginx  ##?關閉nginx ./nginx?-s?stop  ##?重新加載配置文件 ./nginx?-s?reload

域名轉發配置

以下是我的配置文件,我僅僅配置了簡單的域名轉發功能,未使用其他nginx的功能,nginx異常強大,域名轉發只是冰山一角。

##?nginx/conf/nginx.conf  worker_processes?1;  events?{ ??worker_connections?1024; }   http?{ ??include????mime.types; ??default_type?application/octet-stream;  ??sendfile????on;  ??server?{ ????listen????80; ????server_name?www.fbm.com; ????location?/?{ ??????root??html; ??????index?index.html?index.htm; ??????proxy_pass?http://localhost:8080; ????} ??} ??server?{ ????listen?80; ????server_name?fmp.hzfh.com; ????location?/?{ ??????proxy_pass?http://fmp.hzfh.com;? ????} ??} }

注:別忘了在防火墻上開放端口。

? 版權聲明
THE END
喜歡就支持一下吧
點贊5 分享