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 安裝目錄./configuremakemake install
Nginx 常用命令
### nginx/sbin 目錄下 ##### 啟動nginx./nginx## 關閉nginx./nginx -s stop## 重新加載配置文件./nginx -s reload
域名轉發配置
以下是我的配置文件,我僅僅配置了簡單的域名轉發功能,未使用其他nginx的功能,nginx異常強大,域名轉發只是冰山一角。
## nginx/conf/nginx.confworker_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; } }}
注:別忘了在防火墻上開放端口。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持錯新站長站。
新聞熱點
疑難解答