美文网首页
nginx安装配置

nginx安装配置

作者: 信号传D | 来源:发表于2019-02-10 18:51 被阅读0次

安装所需的环境
一.gcc安装

yum install gcc-c++

二.PCRE pcre-devel安装

yum install -y pcre pcre-devel

三.zlib安装

yum install zlib zlib-devel

四.OpenSSL安装

官网下载
1.直接下载tar.gz安装包,地址:https://nginx.org/en/download.html
2.使用wget命令下载

wget -c https://nginx.org/download/nginx-1.15.8.tar.gz

解压

tar -zxvf nginx-1.15.8.tar.gz

cd nginx-1.15.8

配置
1.使用默认的配置
./configure
2.自定义配置

./configure \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/conf/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi

编译安装

make

make install

启动、停止nginx
进入nginx目录

cd /usr/local/nginx/sbin

/nginx //启动nginx

/nginx -s stop //查找进程后kill杀死nginx进程

/nginx -s quit //停止步骤待nginx处理完后进行停止

/nginx -s reload

查询nginx进程

ps aux |grep nginx

重启 nginx
1.#./nginx -s quit

./nginx

2.当配置文件修改后需要重新加载配置文件

./nginx -s reload

/etc/nginx/nginx.conf //配置文件目录
重启nginx后进入浏览器输入127.0.0.1:8080
搭建成功

相关文章

网友评论

      本文标题:nginx安装配置

      本文链接:https://www.haomeiwen.com/subject/nvjxeqtx.html