Skip to content

建站 Nginx 必知必会

bash
nginx -t

# 重新加载配置、证书
nginx -s reload

# 上传证书、网站打包产物
scp -r pingcx.cn_nginx root@1.1.1.1:/etc/nginx/conf.d/cert/api.xxx.cn

# 网站配置路径
/etc/nginx/sites-available

# 证书路径
/etc/nginx/conf.d/cert

配置文件

  • sites-available:存储所有可用的站点配置文件,但不会自动启用它们
  • sites-enabled:存储所有启用的站点配置文件,Nginx 仅加载此目录中的配置文件
  • nginx.conf:主配置文件,会通过 include 引入 sites-enabled 中的配置文件

TODO

  • 反向代理
  • 负载均衡
  • 虚拟主机