Nginx介绍
Nginx是一个高性能的HTTP和反向代理 web服务器,同时也提供了IMAP/POP3/SMTP 服务。其特点是占有内存少,并发能力强。 中国大陆使用nginx网站用户有:百度、京东、 新浪、网易、腾讯、淘宝等。截止到2021年8月,nginx市场份额占全部web 站点的36%,平均每三个站点就会有一个使用。
Nginx常用命令
| 命令 | 功能 |
|---|---|
| nginx | 启动nginx |
| nginx -t | 验证配置文件 |
| nginx -s reload | 重新加载nginx配 |
| nginx -s stop | 快速停止nginx |
| nnginx -s quit | 优雅停止nginx |
| nginx -v | 查看nginx版本 |
| nginx -V | 查看nginx版本和配置信息 |
| nginx –c xx.conf | nginx指定conf文件 |
nginx常用配置和使用案例
nginx反向代理使用场景: 1、后端服务不想将服务本身信息暴露给前端; 2、后端服务存在多个节点,需要进行负载均衡; 3、将三方站点资源引入自己域名下。
location / { proxy_pass http://myupsteam; …… }
通过域名访问: demo.cn/xxx/yyy 实际服务器访问: http://myupsteam/xxx/yyy