ubuntu nginx 重启卸载 nginx 时出现这个东西而且按回车键没有任何反应,该怎么解决?

nginx File not found 错误
使用php-fpm解析,&No input file specified&,&File not found&是令nginx新手头疼的常见错误,原因是php-fpm进程找不到SCRIPT_FILENAME配置的要执行的.php文件,php-fpm返回给nginx的默认404错误提示。
比如我的网站doucument_root下没有test.php,访问这个文件时通过抓包可以看到返回的内容。
HTTP/1.1 404 Not Found
Date: Fri, 21 Dec :28 GMT
Content-Type: text/
Proxy-Connection: close
Server: nginx/1.2.5
X-Powered-By: PHP/5.4.7
Via: 1.1 c3300 (NetCache NetApp/6.0.7)
Content-Length: 16
File not found.
很多人不想用户直接看到这个默认的404错误信息,想自定义404错误.
给出解决办法前我们来先分析下如何避免出现这类404错误,然后再说真的遇到这种情况(比如用户输入一个错误不存在的路径)时该怎么办,才能显示自定义的404错误页。
一、错误的路径被发送到php-fpm进程
出现这类错误,十个有九个是后端fastcgi进程收到错误路径(SCRIPT_FILENAME),而后端fastcgi收到错误路径的原因大都是配置错误。
常见的nginx.conf的配置如下:
& & listen & [::]:80;
& & server_name & ;
& & access_log &/var/www/.access. &
& & location / {
& & & & root & /var/;
& & & & index &index.html index.htm index.
& & location /images {
& & location ~ \.php$ {
& & & & fastcgi_pass & 127.0.0.1:9000;
& & & & fastcgi_index &index.
& & & & fastcgi_param &SCRIPT_FILENAME &/var/$fastcgi_script_
& & & & include fastcgi_
}这个配置中有很多不合理的地方,其中一个明显的问题就是root指令被放到了location / 块。如果root指令被定义在location块中那么该root指令只能对其所在的location生效。其它locaiont中没有root指令,像location /images块不会匹配任何请求,需要在每个请求中重复配置root指令来解决这个问题。因此我们需要把root指令放在server块,这样各个location就会继承父server块定义的$document_root,如果某个location需要定义一个不同的$document_root,则可以在location单独定义一个root指令。
另一个问题就是fastCGI参数SCRIPT_FILENAME 是写死的。如果修改了root指令的值或者移动文件到别的目录,php-fpm会返回&No input file specified&错误,因为SCRIPT_FILENAME在配置中是写死的并没有随着$doucument_root变化而变化,我们可以修改SCRIPT_FILENAME配置如下:
fastcgi_param &SCRIPT_FILENAME &$document_root$fastcgi_script_
所以我们不能忘记在server块中配置root指令,不然$document_root的值为空,只会传$fastcgi_script_name到php-fpm,这样就会导致&No input file specified&错误。
二、请求的文件真的不存在
当nginx收到一个不在的.php文件的请求时,因为nginx只会检查$uri是否是.php结尾,不会对文件是否存在进行判断,.php结尾的请求nginx会直接发给php-fpm处理。php-fpm处理时找不到文件就会返回&No input file specified&带着&404 Not Found&头。
我们在nginx拦截不存在的文件,请求并返回自定义404错误
使用 try_files 捕捉不存在的urls并返回错误。
location ~ .php$ {
&try_files $uri =404;
&fastcgi_pass 127.0.0.1:9000;
&fastcgi_index index.
&fastcgi_param SCRIPT_FILENAME ....
&...................................
&...................................
}上面的配置会检查.php文件是否存在,如果不存在,会返回404页面
详细出处参考:/562.html
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'2351人阅读
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。
正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。
ububtu平台可以使用以下指令
apt-get install build-essential
apt-get install libtool
下面正式开始
---------------------------------------------------------------------------
一般我们都需要先装rewrite zlib,前者为了重写,后者为了gzip压缩。
1.选定源码目录
可以是任何目录,本文选定的是/usr/local/src
cd /usr/local/src
2.安装PCRE库
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/&下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:
cd /usr/local/src
wget&ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz
tar -zxvf pcre-8.32.tar.gz
cd pcre-8.21
./configure
make install
3.安装zlib库
http://zlib.net/zlib-1.2.7.tar.gz&下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:
cd /usr/local/src
wget&http://zlib.net/zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make install
3安装OPenSSL
下载最新的openssl源码包,使用下面命令下载编译和安装
openssl包:
cd /usr/local/src
wget ftp://ftp.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf&openssl-1.0.1c.tar.gz
cd&openssl-1.0.1c
./configure
make install
4.安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:
cd /usr/local/src
wget http://nginx.org/download/nginx-1.2.6.tar.gz
tar -zxvf nginx-1.2.6.tar.gz
cd nginx-1.2.6
./configure --sbin-path=/usr/local/nginx/nginx &--conf-path=/usr/local/nginx/nginx.conf &--pid-path=/usr/local/nginx/nginx.pid &--with-http_ssl_module &--with-pcre=/usr/local/src/pcre-8.32 &--with-zlib=/usr/local/src/zlib-1.2.7 &&--with-openssl=/usr/local/src/openssl-1.0.1c
make install
--with-pcre=/usr/local/src/pcre-8.32& 指的是pcre-8.32 的源码路径。
--with-zlib=/usr/local/src/zlib-1.2.7& 指的是zlib-1.2.7 的源码路径。
--with-openssl=/usr/local/src/openssl-1.0.1c
&指的是openssl 的源码路径。
安装成功后 /usr/local/nginx 目录下如下
确保系统的 80 端口没被其他程序占用,运行/usr/local/nginx/nginx 命令来启动 Nginx,
sudo&/usr/local/nginx/nginx (ubuntu下必须用sudo启动,不然只能在前台运行)
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
附:可能遇到的错误和一些帮助信息
1.编译pcre错误
libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/src/pcre-8.21'
make: *** [all] Error 2
解决办法:安装g++,别忘了重新configure
apt-get install g++
apt-get install build-essential
make clean
./configure
2.nginx编译选项
make是用来编译的,它从Makefile中读取指令,然后编译。
make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。
configure命令是用来检测你的安装平台的目标特征的。它定义了系统的各个方面,包括nginx的被允许使用的连接处理的方法,比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本,执行结束时,它会创建一个Makefile文件。nginx的configure命令支持以下参数:
典型实例(下面为了展示需要写在多行,执行时内容需要在同一行)
./configure
--sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=../pcre-4.4
--with-zlib=../zlib-1.1.3
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。
正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。
ububtu平台可以使用以下指令
apt-get install build-essential
apt-get install libtool
下面正式开始
---------------------------------------------------------------------------
一般我们都需要先装rewrite zlib,前者为了重写,后者为了gzip压缩。
1.选定源码目录
可以是任何目录,本文选定的是/usr/local/src
cd /usr/local/src
2.安装PCRE库
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/&下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:
cd /usr/local/src
wget&ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
tar -zxvf pcre-8.21.tar.gz
cd pcre-8.21
./configure
make install
3.安装zlib库
http://zlib.net/zlib-1.2.7.tar.gz&下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:
cd /usr/local/src
wget&http://zlib.net/zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make install
4.安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:
cd /usr/local/src
wget http://nginx.org/download/nginx-1.2.3.tar.gz
tar -zxvf nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure --sbin-path=/usr/local/nginx/nginx &--conf-path=/usr/local/nginx/nginx.conf &--pid-path=/usr/local/nginx/nginx.pid &--with-http_ssl_module &--with-pcre=/usr/local/src/pcre-8.21 &--with-zlib=/usr/local/src/zlib-1.2.7
make install
--with-pcre=/usr/src/pcre-8.21 指的是pcre-8.21 的源码路径。
--with-pcre=/usr/src/zlib-1.2.7 指的是zlib-1.2.7 的源码路径。
安装成功后 /usr/local/nginx 目录下如下
确保系统的 80 端口没被其他程序占用,运行/usr/local/nginx/nginx 命令来启动 Nginx,
sudo&/usr/local/nginx/nginx (ubuntu下必须用sudo启动,不然只能在前台运行)
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
附:可能遇到的错误和一些帮助信息
1.编译pcre错误
libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/src/pcre-8.21'
make: *** [all] Error 2
解决办法:安装g++,别忘了重新configure
apt-get install g++
apt-get install build-essential
make clean
./configure
2.nginx编译选项
make是用来编译的,它从Makefile中读取指令,然后编译。
make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。
configure命令是用来检测你的安装平台的目标特征的。它定义了系统的各个方面,包括nginx的被允许使用的连接处理的方法,比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本,执行结束时,它会创建一个Makefile文件。nginx的configure命令支持以下参数:
典型实例(下面为了展示需要写在多行,执行时内容需要在同一行)
./configure
--sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=../pcre-4.4
--with-zlib=../zlib-1.1.3Nginx安装nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。ububtu平台可以使用以下指令apt-get install build-essential
apt-get install libtool下面正式开始
---------------------------------------------------------------------------
一般我们都需要先装rewrite zlib,前者为了重写,后者为了gzip压缩。
1.选定源码目录
可以是任何目录,本文选定的是/usr/local/src
cd /usr/local/src
2.安装PCRE库
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/&下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:cd /usr/local/srcwget&ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
tar -zxvf pcre-8.21.tar.gz
cd pcre-8.21
./configure
make install
3.安装zlib库
http://zlib.net/zlib-1.2.7.tar.gz&下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:cd /usr/local/srcwget&http://zlib.net/zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make install4.安装nginxNginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:cd /usr/local/srcwget http://nginx.org/download/nginx-1.2.3.tar.gz
tar -zxvf nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure --sbin-path=/usr/local/nginx/nginx &--conf-path=/usr/local/nginx/nginx.conf &--pid-path=/usr/local/nginx/nginx.pid &--with-http_ssl_module &--with-pcre=/usr/local/src/pcre-8.21 &--with-zlib=/usr/local/src/zlib-1.2.7
make install--with-pcre=/usr/src/pcre-8.21 指的是pcre-8.21 的源码路径。
--with-pcre=/usr/src/zlib-1.2.7 指的是zlib-1.2.7 的源码路径。
安装成功后 /usr/local/nginx 目录下如下确保系统的 80 端口没被其他程序占用,运行/usr/local/nginx/nginx 命令来启动 Nginx,sudo&/usr/local/nginx/nginx (ubuntu下必须用sudo启动,不然只能在前台运行)打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。附:可能遇到的错误和一些帮助信息1.编译pcre错误libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/src/pcre-8.21'
make: *** [all] Error 2解决办法:安装g++,别忘了重新configureapt-get install g++apt-get install build-essentialmake clean./configuremake2.nginx编译选项&make是用来编译的,它从Makefile中读取指令,然后编译。make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。configure命令是用来检测你的安装平台的目标特征的。它定义了系统的各个方面,包括nginx的被允许使用的连接处理的方法,比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本,执行结束时,它会创建一个Makefile文件。nginx的configure命令支持以下参数:&典型实例(下面为了展示需要写在多行,执行时内容需要在同一行)./configure
--sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=../pcre-4.4
--with-zlib=../zlib-1.1.3
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:91747次
排名:千里之外
转载:32篇
(1)(1)(1)(1)(1)(1)(4)(6)(1)(5)(6)(6)(8)(1)Ubuntu下安装nginx的步骤分享
作者:佚名
字体:[ ] 来源:互联网 时间:10-29 23:27:33
在Ubuntu下安装nginx的步骤介绍,使用Ubuntu的朋友可以参考下
1)、下载   sudo wget http://nginx.org/download/nginx-1.2.2.tar.gz 2)、解压   sudo tar -xzvf nginx-1.2.2.tar.gz 3)、进入相关目录进行以下操作 代码如下: ./configure make sudo make install   如果你运气好的话,一切ok,不过...........哈哈。Ubuntu默认的策略是什么库都不装,依赖的库都需要自已手工安装搞定。 一般都会出错的,那么我们来看看可能出现的问题。 4)、常见问题解决办法   缺少pcre library ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=&path& option.    解决方法:下载安装pcre-8.31解决问题,解压后对pcre进行如下操作 代码如下: sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz sudo tar -xzvf pcre-8.31.tar.gz cd /usr/local/src/pcre-8.31 ./configure make sudo make install   运气好一次通过,运气不好,make pcre时会出错 缺少gcc-c++和libtool,也就是c++编译包 代码如下: libtool: compile: unrecognized option `-DHAVE_CONFIG_H' libtool: compile: Try `libtool --help' for more information. make[1]: *** [pcrecpp.lo] Error 1 make[1]: Leaving directory `/usr/local/src//pcre-8.31' make: *** [all] Error 2root@wolfdog-virtual-machine:~/work/pcre-8.12$ libtool -help -DHAVE_CONFIG_H The program 'libtool' is currently not installed. You can install it by typing: sudo apt-get install libtool 解决方法:需要先安装libtool和gcc-c++ ?sudo apt-get install libtool sudo apt-get install gcc-c++   大爷啊~~~这时候可能又会报错啊,坑爹啊~~~   缺少openssl库 代码如下: ./configure: error: the HTTP cache module requires md5 functions from OpenSSL library. You can either disable the module by using --without-http-cache option, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-http_ssl_module --with-openssl=&path& options. 缺少zlib库 代码如下: ./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=&path& option.    解决办法:少什么就安装什么呗。 sudo apt-get install openssl libssl-dev libperl-dev 4)、解决了以上问题,编译nginx就没啥问题了。下面安装。(附加安装插件的方法)   先下载插件并解压 代码如下: sudo wget /agentzh/echo-nginx-module/tarball/v0.40rc1 -O echo-nginx-module.tar.gz sudo wget /agentzh/memc-nginx-module/tarball/v0.13rc3 -O memc-nginx-module.tar.gz sudo tar -xzvf echo-nginx-module.tar.gz sudo tar -xzvf memc-nginx-module.tar.gz   进入nginx目录cd nginx-1.2.2/,执行以下命令 代码如下: ./configure --user=www-data --group=www-data --with-debug --with-http_gzip_static_module --with-http_ssl_module --with-pcre=../pcre-8.31/ --with-http_perl_module --with-perl=/usr/bin/perl --with-http_stub_status_module --with-http_realip_module \ --prefix=/usr/local/nginx \ --add-module=../agentzh-echo-nginx-module-9259898/ \ --add-module=../agentzh-memc-nginx-module-4007350/ \ 注:前面一段是一些编译参数,后面add-module是添加模块 make -j2 make install 大爷的,又可能报错。没有nginx,logs目录访问权限 代码如下: [alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
06:09:33 [emerg] 24855#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)    解决办法: 代码如下: sudo chmod a+rwx -R logs sudo chmod a+rwx -R /usr/local/nginx    现在,差不多没问题了。 可以进入/usr/local/nginx/sbin/执行以下命令看是否成功:   nginx -v 5)、nginx自启动 编辑启动脚本: 代码如下: sudo vim /etc/init.d/nginx 代码如下: #! /bin/bash # # nginx Start up the nginx server daemon # # chkconfig:
# Description: starts and stops the nginx web server # ### BEGIN INIT INFO # Provides: nginx # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: starts and stops the nginx web server ### END INIT INFO # To install: # copy this file to /etc/init.d/nginx # shell& chkconfig --add nginx (RedHat) # shell& update-rc.d -f nginx defaults (debian) # To uninstall: # shell& chkconfig --del nginx (RedHat) # shell& update-rc.d -f nginx remove PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin NAME=nginx DAEMON=/usr/local/nginx/sbin/$NAME CONFIGFILE=/usr/local/nginx/conf/$NAME.conf PIDFILE=/var/local/nginx/logs/$NAME.pid ULIMIT=10240 set -e [ -x "$DAEMON" ] || exit 0 do_start() { echo "Starting $NAME ..." ulimit -SHn $ULIMIT $DAEMON -c $CONFIGFILE } do_stop() { echo "Shutting down $NAME ..." kill 'cat $PIDFILE' } do_reload() { echo "Reloading $NAME ..." kill -HUP 'cat $PIDFILE' } case "$1" in start) [ ! -f "$PIDFILE" ] && do_start || echo "nginx already running" echo -e ".\ndone" ;; stop) [ -f "$PIDFILE" ] && do_stop || echo "nginx not running" echo -e ".\ndone" ;; restart) [ -f "$PIDFILE" ] && do_stop || echo "nginx not running" do_start echo -e ".\ndone" ;; reload) [ -f "$PIDFILE" ] && do_reload || echo "nginx not running" echo -e ".\ndone" ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload}" &&2 exit 1 ;; esac exit 0 红色部分,根据自己的路径修改。 6)、常用命令 重启nginx:service nginx restart 启动:service nginx start 关闭:service nginx stop 7)、linux常用命令 tar(z-用 gzip 对存档压缩或解压;x-从存档展开文件;v-详细显示处理的文件;f-指定存档或设备) tar &zxvf nginx-0.8.54.tar.gz ip查看 ifconfig 编译 make 安装编译好的源码包 make install 编辑文件 sudo gedit /etc/profile 修改根限:chmod说明(u:与文件属主拥有一样的权限[a:所有人];+:增加权限;rwx:可读可写可执行) -R:递归所有目录和文件 sudo chmod a+rwx -R logs 检查是库是否安装成功 dpkg --list|grep openssl 下载安装库 sudo apt-get install libtool 检查服务启动是否正常 ps -ef|grep 查找openssl安装路径 whereis openssl 更新源 sudo apt-get update 更新已安装的包 sudo apt-get upgrade
大家感兴趣的内容
12345678910
最近更新的内容nginx配置失败,卸载后重装出问题awk:cannotopen/etc/nginx/nginx.conf(Nosuchfileordirectory)
nginx配置失败,卸载后重装出问题
wangyaofeng@wangyaofeng-NJ091AA-AB2-g3721cx:~$ sudo apt-get install nginx
正在读取软件包列表
正在分析软件包的依赖关系树
正在读取状
nginx配置失败,卸载后重装出问题
wangyaofeng@wangyaofeng-NJ091AA-AB2-g3721cx:~$ sudo apt-get install nginx
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
nginx-common nginx-core
建议安装的软件包:
fcgiwrap nginx-doc
下列【新】软件包将被安装:
nginx nginx-common nginx-core
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 12 个软件包未被升级。
需要 0 B/348 kB 的软件包。
解压缩后会消耗掉 1,296 kB 的额外空间。
您希望继续执行吗? [Y/n] y
正在选中未选择的软件包 nginx-common。
(正在读取 ... 当前共安装有 192360 个文件和目录。)
正准备解包 .../nginx-common_1.4.6-1ubuntu3.2_all.deb
正在解包 nginx-common (1.4.6-1ubuntu3.2) ...
正在选中未选择的软件包 nginx-core。
正准备解包 .../nginx-core_1.4.6-1ubuntu3.2_amd64.deb
正在解包 nginx-core (1.4.6-1ubuntu3.2) ...
正在选中未选择的软件包 nginx。
正准备解包 .../nginx_1.4.6-1ubuntu3.2_all.deb
正在解包 nginx (1.4.6-1ubuntu3.2) ...
正在处理用于 man-db (2.6.7.1-1ubuntu1) 的触发器 ...
正在处理用于 ufw (0.34~rc-0ubuntu2) 的触发器 ...
正在处理用于 ureadahead (0.100.0-16) 的触发器 ...
ureadahead will be reprofiled on next reboot
正在设置 nginx-common (1.4.6-1ubuntu3.2) ...
正在设置 nginx-core (1.4.6-1ubuntu3.2) ...
awk: cannot open /etc/nginx/nginx.conf (No such file or directory)
正在设置 nginx (1.4.6-1ubuntu3.2) ...
参考 http://www.111cn.net/sys/nginx/69517.htm
完全卸载nginx
在配置nginx做实验时配置错了,导致访问不了虚拟主机。一狠心把nginx的配置文件目录(/etc/nginx)都删除了,而且我没有备份这些配置文件,因此想重装nginx。
本来以为直接使用如下apt-get指令
sudo apt-get --purge remove nginx
sudo apt-get install nginx
就可以搞定,但实际上并没有有自动产生nginx的配置文件,连/etc/nginx目录都没产生。
于是autoremove
sudo apt-get --purge remove nginx
sudo apt-get autoremove
sudo apt-get install nginx
awk: cannot open /etc/nginx/nginx.conf (No such file or directory)
虽然产生了/etc/nginx目录了,但只有部分配置文件
conf.d sites-available sites-enabled
sudo apt-get --purge remove nginx
sudo apt-get autoremove
dpkg --get- selections|grep nginx
罗列除与nginx相关的软件,
nginx-common deinstall
sudo apt-get --purge remove nginx-common
sudo apt-get install nginx

我要回帖

更多关于 ubuntu卸载nginx 的文章

 

随机推荐