Nginx 简介与优势
Nginx 介绍
Nginx(“engine x”)是由俄罗斯程序员 Igor Sysoev 开发的一款高性能 Web 服务器及反向代理服务器,同时支持 IMAP/POP3/SMTP 协议。在处理高连接并发请求时,Nginx 是 Apache 服务器的优秀替代方案。
Nginx 安装步骤
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 常用命令
### nginx/sbin 目录下 ###
## 启动nginx
./nginx
## 关闭nginx
./nginx -s stop
## 重新加载配置文件
./nginx -s reload
域名转发配置方法
域名转发配置
以下展示配置文件示例,仅包含基础的域名转发功能,未涉及其他高级特性。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;
}
}
}
注意:务必在防火墙上开放相关端口。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持本站。