Install nginx on ubuntu

Source: Internet
Author: User
: This article describes how to install nginx on ubuntu. if you are interested in the PHP Tutorial, refer to it. Recently, I feel that I have not been in touch with the lnmp development environment to build, configure, and so on. as a result, sometimes I cannot remember how to use the environment, so I configure the environment separately.
I tried to install apt-get install nginx first, but a strange error occurred, causing apt-get remove nginx to fail.

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

Delete all the nginx files, but re-installing the nginx still fails. temporarily abandon the apt-get installation method, and use the source code method.

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

An error occurred when I started it.

Starting nginx: nginx: [emerg] bind() to0.0.0.0:80 failed (98: Address already inuse)nginx: [emerg] bind() to0.0.0.0:80 failed (98: Address already inuse)nginx: [emerg] bind() to0.0.0.0:80 failed (98: Address already inuse)nginx: [emerg] bind() to0.0.0.0:80 failed (98: Address already inuse)nginx: [emerg] bind() to0.0.0.0:80 failed (98: Address already inuse)nginx: [emerg] still could not bind()

It may be because apt-get fails to be installed, or other programs occupy the port and kill the program that occupies the port.

sudo fuser -k 80/tcp

Restart. No problem

/etc/init.d/nginx

But when I run/etc/init.d/nginx stopAn error occurred again. invalid stop. I am wondering how to stop nginx. I just used this.

killall -9 nginx

You can do it directly at startup./etc/init.d/nginxOK.killall -9 nginx

Then run localhost: 80 in the browser.

'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
  • '). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script

    The above section describes how to install nginx on ubuntu, including some content. I hope my friends who are interested in the PHP Tutorial can help me.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.