If you are installing nginx in ubuntun, it is recommended that you uninstall the built-in version, the old version, the 0.7 version, and the uWsgi version are not supported, and you need to install patches. This is too troublesome. If it is installed by default the apt-get method must be used for installation, so we will use the apt-get method to uninstall it,
sudo apt-get --purge remove nginx
Then, try again. If which nginx does not exist or does not exist, it is unloaded successfully.
Install it from the source code, so you don't have to worry about updating the apt-get source or the like,
First, find the source code. The latest stable version on the official website is 1.0.10.
wget http://nginx.org/download/nginx-1.0.10.tar.gz
Obtain the current directory and decompress tar-zxf xxxx.tar.gz.
Then let's install it, and install the three steps from the source code. If there is no accident, it will be smooth,
./configure
make
sudo make install
Run./configure first, and then do not rush to execute it. Check whether the configuration is correct. If you do not see it clearly, executing make will definitely cause problems. If you see it during make
Make: *** No rule to make target 'build', needed by 'default '. stop. look back. /configure error information is not installed with a component, such as not installed
Of course, the official website also provides a higher compression rate.
Refer format
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
Run the command again./configure, make, make install again. The problem is not big. Note that make install requires the root permission. If it is ubuntu, you can use sudo to temporarily call the root permission,
Nginx is installed, but it is not available yet. Enter the nginix directory. Generally. if/configure does not specify a directory for installation, it is installed in/usr/local/nginx. If you want to specify another directory, use the -- prefix = xxx directory. If you want to install it in the default directory, run soft link command to connect nginx to the/usr/bin directory,
sudo ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
Note, root permission, and I believe it is not a big problem. Then, you can run nginx anywhere. Run nginx-v. If you see the version number, the installation is complete,
Then start nginx
If nginx is run, an error occurs during startup, and an error occurs while loading shared libraries: libpcre. so.0: cannot open shared object file: No such file or directory.
Then the system cannot find a database, and it just needs to make a soft link under/usr/local.
sudo ln -s /usr/local/lib/libpcre.so.0 /usr/lib/libpcre.so.0
Okay. Start nginx. Check whether the welcome page of nginx is displayed.
If an error occurs during startup, such information
Nov 19 22:06:09 fedora nginx[17850]: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 19 22:06:10 fedora nginx[17850]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 19 22:06:10 fedora nginx[17850]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 19 22:06:11 fedora nginx[17850]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 19 22:06:11 fedora nginx[17850]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Nov 19 22:06:12 fedora nginx[17850]: nginx: [emerg] still could not bind()
It may be because the port is occupied. Check if your apache service has started port 80 and you can stop it.
sudo /etc/init.d/apache2 stop