更新源并下载
sudo apt update
sudo apt install nginx
编译tengin
./configure --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx
make 生成 nginx 执行文件
make
将原声nginx备份
sudo mv /usr/sbin/nginx /usr/sbin/nginx.old
把make 生成的执行文件复制 到 原声nginx 目录下
sudo cp objs/nginx /usr/sbin/
给它执行权限
sudo chmod +x /usr/sbin/nginx
查看原有Nginx版本
$nginx -v
#得到结果Tengine version: Tengine/2.2.0 (nginx/1.8.1)
$sudo nginx -t
得到结果
#nginx: the configuration file /etc/nginx//conf/nginx.conf syntax is ok
#nginx: configuration file /etc/nginx//conf/nginx.conf test is successful
#并且进入sudo vim /lib/systemd/system/nginx.service 修改 nginx 主要修改ngin.pid 的路径 保存
完美卸载命令
sudo apt-get remove nginx nginx-common
sudo apt-get purge nginx nginx-common
sudo apt-get autoremove
sudo apt-get remove nginx-full nginx-common