0.安装Nginx依赖包
yum install -y pcre-devel zlib-devel openssl-devel wget gcc tree vim
|
1.从Nginx官网下载并解压源码包
wget https://nginx.org/download/nginx-1.16.1.tar.gz tar -zxvf nginx-1.16.1.tar.gz
|
2.Nginx编译前配置
cd nginx-1.16.1 ./configure --prefix=/usr/local/nginx --with-http_ssl_module
--prefix:配置configure脚本,软件的安装位置
|
3.进行安装编译
4.检查安装情况
进入安装目录进行检查
cd /usr/local/nginx
/usr/local/nginx/conf/nginx.conf
|
运行nginx
5.停止Nginx
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s quit
killall nginx
|
6.Nginx添加到环境变量
使用软连接将nginx
链接到/usr/local/sbin
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin ll /usr/local/sbin/ | grep "nginx"
|
echo $PATH
vim ~/.bashrc
export PATH=$PATH:/usr/local/nginx/sbin
source ~/.bashrc
|