Nginx 域名轉發(fā)的實現(xiàn)
Nginx 介紹
Nginx(“engine x”)是一款是由俄羅斯的程序設計師Igor Sysoev所開發(fā)高性能的 Web和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 代理服務器。在高連接并發(fā)的情況下,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
域名轉發(fā)配置
以下是我的配置文件,我僅僅配置了簡單的域名轉發(fā)功能,未使用其他nginx的功能,nginx異常強大,域名轉發(fā)只是冰山一角。
## 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; } } }
注:別忘了在防火墻上開放端口。
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
Nginx下支持Thinkphp URL Rewrite的配置示例
這篇文章主要介紹了Nginx下支持Thinkphp URL Rewrite的配置示例,本文直接給出配置示例,需要的朋友可以參考下2015-07-07nginx 反向代理之 proxy_pass的實現(xiàn)
這篇文章主要介紹了nginx 反向代理之 proxy_pass的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-11-11