# nginx startup
# nginx install
- 新建 nginx.repo 文件
h | $ vi /etc/yum.repos.d/nginx.repo |
h | |
| [nginx] |
| name=nginx repo |
| baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/ |
| gpgcheck=0 |
| enabled=1 |
- 安装
h
# nginx flow
h | |
| $ nginx -t |
| |
| |
| $ systemctl start nginx |
| $ systemctl enable nginx |
| |
| |
| $ systemctrl reload nginx |
# nginx resources
- Nginx 如何设置 IPv6 网站
- nginxconfig.io
# nginx tips
# nginx 反向代理 (proxy) 时传递真实 IP
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# nginx 获取、返回 IP
location /ip {
default_type text/plain;
return 200 $remote_addr;
}
location /json_ip {
default_type application/json;
return 200 "{\"ip\":\"$remote_addr\"}";
}
# nginx 403 for forbidden
hhttp://www.ha97.com/4336.html
https://www.barretlee.com/blog/2016/11/19/nginx-configuration-start/
# nginx 配置二级域名
- 在运营商处未二级域名添加解析 (多个二级域名解析到同一个 ip 即可)
- 在 nginx server 模块中添加配置
server_name 2.yourdomain.top two.youdomain.cc;
# Resources
- 如何改进 NGINX 配置文件节省带宽? - NGINX 官方的博客文章,教大家五个小技巧,通过改进配置来节省带宽、提高性能。
- NGINX Config