Nginx Crash Course

Nginx 基础教程

安装

服务启停

  • Windows: 双击 nginx.exe 打开即可,可在任务管理器查看到 Nginx 的进程

  • Linux:

    nginx
    
    ps -ef|grep nginx    # 查看 Nginx 进程
    lsof -i:80           # 查看 80 端口占用
    
    nginx -s quit    # 优雅停止
    nginx -s stop    # 立即停止
    nginx -s reload  # 重载配置文件
    nginx -s reopen  # 重新打开日志文件
    
nginx -V    # 查看 Nginx 安装目录/配置文件位置等
nginx -t    # 查看 Nginx 配置文件位置
  • 配置文件位置: --conf-path=/etc/nginx/nginx.conf
  • 安装目录: --prefix=/usr/share/nginx
#gzip  on;
/etc/nginx/sites-enabled
/etc/nginx/conf.d
/usr/share/nginx
/var/www/

References:

Honghao Chen
Honghao Chen
Gameplay Engineer

Gameplay Engineer | M.S. in Software Engineering @ CMU | B.E. in Computer Engineering @ CUHK(SZ)