Install or uninstall Nginx__linux under Linux

Source: Internet
Author: User
Tags bz2
Install or uninstall Nginx under Linux

If you are installed under the Ubuntun Nginx, it is recommended to uninstall the version of the first, too old, 0.7, Uwsgi do not support, but also to play patches, too much trouble, if it is the default installation, it must be used apt-get way to install, Then we use the Apt-get way to uninstall it,

sudo apt-get--purge remove Nginx

When you're done, try again. Which Nginx exists or has been successfully unloaded

or from the source installation bar, so you can not update the apt-get source, such as the success of such,

First to find a source bar, the current official website of the latest stable version is 1.0.10, so enter a

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

Get to the current directory and then unzip the TAR-ZXF xxxx.tar.gz

Then install it, install from the source code three steps if there is no accident is ruthless smooth,

./configure
make
sudo make install

Execute first./configure do not rush down to perform, see Configuration is not wrong, if you do not see clearly, the implementation of make will certainly be problematic, if you see the show

Make: * * * "rule" to "make target" build ", needed by ' default '. Stop. This phenomenon, you look back./configure error message is not installed a component, such as not installed

Pseudo-static module needs Pcre Library, this is a common problem, not installed on it, the current pcre version of 8.12, if you want to download the best choice tar.gz, of course, the official website also provides a higher compression rate

TAR.BZ2 format, but decompression slightly trouble point, need to use bzip2 this tool, first decompression, then unpack, xxx, but my speed is not slow, too troublesome or honest with tar.gz format it

bzip2-d xxx.tar.bz2
tar-xf Xxx.tar
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz

Get it done, run it again./configure, then make, make install, not much of a problem, pay attention to made install to root permissions, if it is Ubuntu, you can use sudo to temporarily invoke root permissions,

Nginx is installed, but can not be used, into the Nginix directory, generally speaking./configure does not specify directory installation is installed in/usr/local/nginx, if you want to specify other directories to use the--prefix=xxx directory, If you are installed in the default directory, the implementation of a soft link command to Nginx to the/usr/bin directory,

sudo ln-s/usr/local/nginx/sbin/nginx/usr/sbin/nginx

Attention, root permissions, believe that there is not much problem, and then where can run Nginx, execute a nginx-v if you see the version number even if the installation is complete,

Then it starts nginx.

If you run Nginx, you start an error, you encounter an error while loading shared Libraries:libpcre.so.0:cannot open Shared object file:no such file or dire Ctory

Then the system can not find a certain library, the/usr/local to do a soft link to move over the

sudo ln-s/usr/local/lib/libpcre.so.0/usr/lib/libpcre.so.0

OK, start Nginx bar, want to verify, with the browser open localhost:80 slightly, see if you see the Nginx Welcome page, if the line is OK

If you start an error, information like this

Nov 22:06:09 Fedora nginx[17850]: Starting Nginx:nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already in US e)
Nov 22:06:10 Fedora nginx[17850]: nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already in use)
No V 22:06:10 Fedora nginx[17850]: nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already in use)
Nov 19 22:0 6:11 Fedora nginx[17850]: nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already into use)
Nov 22:06:11 Fedo RA nginx[17850]: nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already into use)
Nov 22:06:12 Fedora nginx[ 17850]: nginx: [Emerg] still could not bind ()

So malicious may be the port is occupied, to see if you started the Apache service occupies 80 ports, it can be stopped

Sudo/etc/init.d/apache2 stop

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.