nginx

安装

二进制安装

brew install nginx

编译源码安装

cp /nginx-1.9.13.tar.gz /export/server/
cd /export/server/
tar -xzvf nginx-1.9.13.tar.gz
cd /export/server/nginx-1.9.13/
./configure --prefix=/export/server/nginx  --with-stream --without-http_rewrite_module --without-http_gzip_module
make
make install

nginx按需进行构建,配置构建参数,参考:nginx构建配置

控制命令

启动nginx

./sbin/nginx

nginx -s signal signal包含以下四个:

  • stop — fast shutdown
  • quit — graceful shutdown
  • reload — reloading the configuration file
  • reopen — reopening the log files

使用配置

静态html服务器配置

events {
    worker_connections  1024;
}

http {
    server {
        listen 9999;
        root html;
    }
}

重点是root 配置的 html文件夹.

代理服务器