1 #更新源并下载 2 sudo apt update 3 sudo apt install nginx 4 5 6 #编译tengin 7 ./configure --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx 8 #make 生成 nginx 执行文件 9 make 10 11 #将原声nginx备份 12 sudo mv /usr/sbin/nginx /usr/sbin/nginx.old 13 #把make 生成的执行文件复制 到 原声nginx 目录下 14 sudo cp objs/nginx /usr/sbin/ 15 #给它执行权限 16 sudo chmod +x /usr/sbin/nginx 17 18 #查看原有Nginx版本 19 $nginx -v 20 #得到结果Tengine version: Tengine/2.2.0 (nginx/1.8.1) 21 $sudo nginx -t 22 #得到结果 23 #nginx: the configuration file /etc/nginx//conf/nginx.conf syntax is ok 24 #nginx: configuration file /etc/nginx//conf/nginx.conf test is successful 25 #并且进入sudo vim /lib/systemd/system/nginx.service 修改 nginx 主要修改ngin.pid 的路径 保存
26 27 #完美卸载命令 28 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