新聞中心
一、nginx卸載重裝前的準(zhǔn)備工作
在進(jìn)行nginx卸載重裝之前,我們需要做好以下幾方面的準(zhǔn)備工作:

成都創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比云霄網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式云霄網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋云霄地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。
1. 備份網(wǎng)站數(shù)據(jù):在進(jìn)行任何操作之前,我們都需要確保網(wǎng)站的數(shù)據(jù)已經(jīng)備份,以防止在卸載和重裝過程中出現(xiàn)數(shù)據(jù)丟失的問題。
2. 停止正在運(yùn)行的nginx服務(wù):在卸載和重裝nginx之前,需要先停止正在運(yùn)行的nginx服務(wù),以免影響到其他程序的正常運(yùn)行,可以使用以下命令來停止nginx服務(wù):
sudo service nginx stop
3. 檢查系統(tǒng)依賴:在卸載和重裝nginx之前,需要檢查系統(tǒng)中是否還有其他的軟件包依賴于nginx,如果有,需要先卸載這些依賴,以免在重新安裝nginx時(shí)出現(xiàn)問題,可以使用以下命令來查看系統(tǒng)中的軟件包依賴:
dpkg --get-selections | grep nginx
4. 下載nginx安裝包:在卸載和重裝nginx之前,需要先從官方網(wǎng)站或者其他可信的來源下載最新版本的nginx安裝包,可以使用以下命令來下載nginx安裝包:
wget http://nginx.org/download/nginx-1.20.1.tar.gz
二、卸載nginx
1. 刪除nginx安裝目錄:使用以下命令來刪除已經(jīng)安裝的nginx目錄:
sudo rm -rf /usr/local/nginx
2. 刪除nginx配置文件:使用以下命令來刪除已經(jīng)安裝的nginx配置文件:
sudo rm /etc/nginx/nginx.conf
3. 刪除nginx相關(guān)文件:使用以下命令來刪除與nginx相關(guān)的文件:
sudo rm /usr/local/nginx/sbin/nginx* sudo rm /usr/local/nginx/conf/nginx*
4. 刪除系統(tǒng)服務(wù):使用以下命令來刪除已經(jīng)安裝的nginx系統(tǒng)服務(wù):
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-utils sudo apt-get autoremove sudo apt-get autoclean
三、安裝并啟動(dòng)nginx
1. 解壓安裝包:使用以下命令來解壓剛剛下載的nginx安裝包:
tar -zxvf nginx-1.20.1.tar.gz
2. 編譯并安裝:進(jìn)入解壓后的目錄,執(zhí)行以下命令來編譯并安裝nginx:
“`
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-openssl && 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 openresty/compat/libpcre.a openresty/compat/libpcre++.a openresty/compat/libpcrealt.a openresty/compat/libpcre2.a openresty/compat/libpcre2posix.a openresty/compat/libssp.a openresty/compat/libcrypt.a openresty/compat/libcrypto.a openresty/compat/zlib.a openresty/compat/libpng15.a openresty/compat/libjpeg8.a openresty/compat/libfreetype6.a openresty; sudo mkdir -p /usr/local/openresty; sudo mv openresty/* /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 openresty_VERSIONNUMBER_all.tar.gz; cd openresty_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
分享標(biāo)題:nginx卸載重裝配置沒變
轉(zhuǎn)載源于:http://m.fisionsoft.com.cn/article/cohsepj.html


咨詢
建站咨詢
