linux下 Nginx 搭建与配置
- 安装依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
- 下载安装文件
cd /usr/local mkdir nginx cd nginx wget http://nginx.org/download/nginx-1.15.9.tar.gz tar -xvf nginx-1.15.9.tar.gz
- l 安装nginx
cd /usr/local/nginx
#支持https和tcp/udp
./configure --with-http_ssl_module --with-stream make make install
#如果想增加其他参数重新配置
./configure 所有配置
make
cp ./objs/nginx /usr/local/nginx/sbin/
#最后重启nginx即可
- nginx常用指令
校验配置文件 /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf 启动nginx /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 重新加载配置文件 /usr/local/nginx/sbin/nginx -s reload 停止nginx pkill -9 nginx 平滑重启kill -HUP Nginx主进程号 查看nginx进程ps -ef|grep nginx