nginx卸载重装配置没变
在进行nginx卸载重装之前,我们需要做好以下几(ji)方面(mian)的载重装配置没准(zhun)备工作:
1. 备份网站数据:在进行任(ren)何操作之前,我(wo)们都需(xu)要(yao)确保网站的载重(zhong)装配置没数(shu)据已(yi)经备份,以防止在卸载和重装过程中出现数据丢失的载重装配置没问题。



sudo service nginx stop3. 检查系统依赖:在卸载和重装nginx之前,载重装配置没需要检查系统中(zhong)是载重装配置没否还(hai)有(you)其他的软件(jian)包依赖于nginx,如果有(you),需要先卸载这些依赖,载重(zhong)装配置没以免在重新安装nginx时出现问(wen)题,载(zai)重装配置没可(ke)以使用以下命令来查看系统(tong)中的载重装配置没软件包依赖:
dpkg --get-selections | grep nginx4. 下载nginx安装包:在卸载和重装nginx之前,需要先从官方网站或者其他可信的载重(zhong)装配置没来源下载最新版本的nginx安装包,可以使用以下命令来下载nginx安装(zhuang)包:
wget http://nginx.org/download/nginx-1.20.1.tar.gz
1. 删除nginx安装目录:使用(yong)以下(xia)命令来删除已经安装的nginx目录:
sudo rm -rf /usr/local/nginx2. 删除nginx配置文件:使用以下命令来删除已经(jing)安装的nginx配置文件:
sudo rm /etc/nginx/nginx.conf3. 删除nginx相关(guan)文(wen)件:使用以下命令来删除与nginx相关的文件:
sudo rm /usr/local/nginx/sbin/nginx*sudo rm /usr/local/nginx/conf/nginx*
4. 删除系(xi)统服务:使用以下(xia)命令来删除已经安装的nginx系统服务:
sudo apt-get remove --purge nginx-common libnginx-mod-http-ssl-module libnginx-mod-http-v2_6-module libnginx-mod-http-v2_7-module libnginx-mod-perl-module libnginx-mod-rtmp-module libnginx-mod-udp-module libnginx-mod-utils-curl libnginx-mod-utils-java libnginx-mod-xml2-utilssudo apt-get autoremovesudo apt-get autoclean
1. 解压安装包:使用以下命令来解压刚刚下载的nginx安装包:
tar -zxvf nginx-1.20.1.tar.gz
“`
cd nginx-1.20.1/src/configure && sudo make && sudo make install && sudo make test && sudo make install-libs && sudo make install-html && sudo make install-devel && sudo make install-open='open'ssl && sudo make install-pcre && sudo make install-libpcre && sudo make install-compat && sudo make install-ngx_http_geoip_module && sudo make install-ngx_http_image_filter_module && sudo make install-ngx_http_map_module && sudo make install-ngx_http_memcached_module && sudo make install-ngx_http_referer_module && sudo make install-ngx_http_stub_status_module && sudo make install-ngx_http_userid_module && sudo make install-ngx_http_xsltproc_module && sudo make install-ngx_http_zip_module && sudo make install-openresty && sudo make install-luajit && sudo make install-luac; sudo ldconfig; cd ../objs && sudo cp objs/server objs/geoip objs/imagefilter objs/map objs/memcached objs/referer objs/stubstatus objs/userid objs/xsltproc objs/zip openresty/luajit/luajit.so openresty/luajit/libluajit.a open=""resty/compat/libpcre.a open='open'resty/compat/libpcre++.a open="open"resty/compat/libpcrealt.a open="open"resty/compat/libpcre2.a open='open'resty/compat/libpcre2posix.a open="open"resty/compat/libssp.a open='open'resty/compat/libcrypt.a open="open"resty/compat/libcrypto.a openresty/compat/zlib.a open='open'resty/compat/libpng15.a open=""resty/compat/libjpeg8.a open='open'resty/compat/libfreetype6.a open=""resty; sudo mkdir -p /usr/local/open='open'resty; sudo mv open=""resty/* /usr/local/openresty; sudo chmod a+rx -R /usr/local; sudo chmod a+rx ???????????????????????????????; sudo chmod a+rx ????????????????????????; sudo chmod u+x *; sudo chmod u+x conf/*; sudo chmod u+x conf/*.conf; sudo chmod u+x conf/*.htm; sudo chmod u+x conf/*.html; sudo chmod u+x conf/*.js; sudo chmod u+x conf/*.php; sudo chmod u+x conf/*.py; sudo chmod u+x conf/*.txt; sudo chmod u+w conf/*; sudo chmod u+w conf/*.conf; sudo chmod u+w conf/*.htm; sudo chmod u+w conf/*.html; sudo chmod u+w conf/*.js; sudo chmod u+w conf/*.php; sudo chmod u+w conf/*.py; sudo chmod u+w conf/*.txt; sudo find var tmp logs etc !( -name ‘*’ ) > tmpfileslist; for file in `cat tmpfileslist` do if [ `echo $file | cut -b1` = “‘” ] then continue else echo “sudo chown root:root $file”; done; cat tmpfileslist | xargs sudo chgrp root:root; cat tmpfileslist | xargs sudo chmod g=u,o=g $file; cat tmpfileslist | xargs sudo chattr +i $file; find var tmp logs etc !( -name ‘*’ ) > tmpfileslist; for file in `cat tmpfileslist` do if [ `echo $file | cut -b1` = “‘” ] then continue else echo “sudo touch $file”; done; cat tmpfileslist | xargs sudo touch $file; find var tmp logs etc | sort | uniq > filestoinstall; for file in `cat filestoinstall` do if [ `echo $file | cut -b1` = “‘” ] then continue else echo “sudo mv $file $file”; done; find var tmp logs etc | sort | uniq > filestodelete; for file in `cat filestodelete` do if [ `echo $file | cut -b1` = “‘” ] then continue else echo “sudo del $file”; done; exit; cd ~; wget tar zxf open=""resty_VERSIONNUMBER_all.tar.gz; cd open=""resty_VERSIONNUMBER; export NGINXROOT=`pwd`export NGINXCONF=$NGINXROOT’conf’export NGINXDAILY=$NGINXROOT’logs’export NGINXBINDIR=$NGINXROOT’bin’export NGINXLIBDIR=$NGINXROOT’lib’export NGINXVARDIR=$NGINXROOT’var’export NGINXMANDIR=$NGINXROOT’man’export NGINXDOCDIR=$NGINXROOT’doc’export NGINXPKGCONFIGDIR=$NGINXROOT’pkgconfig’export NGINXPIDDIR=$NGINXROOT’pids’export NGINXRUNDIR=$NGINXROOT’run’export NGINXLOCKDIR=$NGINXROOT’lock’export NGINXHTTPDUSER=wwwmake all install clean test deps rewrite reload restart graceful shutdown reopen reload save config save config dirty force reload reloadsave load test check status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version updowndownupupcheck status version up