Nginx 介紹
Nginx(“engine x”)是一款是由俄羅斯的程序設計師Igor Sysoev所開發高性能的 Web和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 代理服務器。在高連接并發的情況下,Nginx是Apache服務器不錯的替代品。
Nginx 安裝
1. 安裝編譯工具及庫文件
1
|
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel |
2. 安裝 PCRE
1
2
3
4
|
自行下載解壓源碼包 cd 安裝目錄 . /configure make && make install // 編譯安裝 |
3. 安裝 Nginx
1
2
3
4
5
|
自行下載解壓源碼包 cd 安裝目錄 . /configure make make install |
Nginx 常用命令
1
2
3
4
5
6
7
8
9
10
|
### nginx/sbin 目錄下 ### ## 啟動nginx . /nginx ## 關閉nginx . /nginx -s stop ## 重新加載配置文件 . /nginx -s reload |
域名轉發配置
以下是我的配置文件,我僅僅配置了簡單的域名轉發功能,未使用其他nginx的功能,nginx異常強大,域名轉發只是冰山一角。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
## 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; } } } |
注:別忘了在防火墻上開放端口。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/qq_21358931/article/details/78395516