- ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法
解决依赖包openssl安装,命令:
sudo apt-get install openssl libssl-dev
解决依赖包pcre安装,命令:
sudo apt-get install libpcre3 libpcre3-dev
解决依赖包zlib安装,命令:
sudo apt-get install zlib1g-dev - 前面安装完成之后将压缩包放到/usr/local
- 解压tar -xzf nginx-1.16.1.tar.gz
- 进入解压后文件看到configure
(1)直接 ./configure
(2)或者自定义参数
./configure --prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--modules-path=/usr/local/nginx/modules \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--pid-path=/usr/local/nginx/logs/nginx.pid \
--lock-path=/usr/local/nginx/logs/nginx.lock
- 编译
make - 安装
make install
验证是否按照成功,进入/usr/local/nginx/sbin目录
./nginx -V
,通过该命令可以查看到所安装Nginx的版本及相关配置信息
验证配置./nginx -t
启动./nginx
重启./nginx -s relaod
t停止./nginx -s stop