Heim >Backend-Entwicklung >PHP-Tutorial >ubuntu 安装 nginx一

ubuntu 安装 nginx一

WBOY
WBOYOriginal
2016-07-29 09:05:54975Durchsuche

最近感觉好久没有接触lnmp开发环境搭建,配置等等,导致有时候用的时候会记不起来,所以单独配置配置环境,练习下
我最先尝试用 apt-get install nginx 安装 ,但是出现了很奇怪的错误,导致apt-get remove nginx 也失败,最后通过

find / -name '*nginx*' | xargs rm -rf

把 nginx 的文件全部删除啦,但是重新安转还是失败,暂时放弃apt-get 的安装方式,而采用源码方式

su

cd /usr/local/src

wget http://nginx.org/download/nginx-1.9.6.tar.gz

tar -zxvf nginx-1.9.6.tar.gz

cd nginx-1.9.6

./configure --prefix=/usr/local/nginx

make

make install

ln -s /usr/local/nginx/sbinb/nginx /etc/init.d

当我启动的时候 出错了

<code>Starting nginx: nginx: [emerg] bind() <span>to</span><span>0.0</span><span>.0</span><span>.0</span>:<span>80</span> failed (<span>98</span>: Address already <span>in</span><span>use</span>)
nginx: [emerg] bind() <span>to</span><span>0.0</span><span>.0</span><span>.0</span>:<span>80</span> failed (<span>98</span>: Address already <span>in</span><span>use</span>)
nginx: [emerg] bind() <span>to</span><span>0.0</span><span>.0</span><span>.0</span>:<span>80</span> failed (<span>98</span>: Address already <span>in</span><span>use</span>)
nginx: [emerg] bind() <span>to</span><span>0.0</span><span>.0</span><span>.0</span>:<span>80</span> failed (<span>98</span>: Address already <span>in</span><span>use</span>)
nginx: [emerg] bind() <span>to</span><span>0.0</span><span>.0</span><span>.0</span>:<span>80</span> failed (<span>98</span>: Address already <span>in</span><span>use</span>)
nginx: [emerg] still could <span>not</span> bind()</code>

可能因为之前apt-get 安装失败有关系,或者其他的程序占用了这个端口,杀死占用这个端口的程序

sudo fuser -k 80/tcp

重新启动,没问题

/etc/init.d/nginx

但是当我 运行/etc/init.d/nginx stop 竟然又出错啦,invalid stop, 很纳闷,那怎么来终止nginx呢,我直接用这个啦

killall -9 nginx

搞定啦,启动时候直接/etc/init.d/nginx 就ok,停止就killall -9 nginx

然后浏览器运行 localhost:80 搞定啦

ubuntu 安装 nginx一

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了ubuntu 安装 nginx一,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn