The first choice is to install nginx. /check the error report when configure fails. If necessary libraries are missing and these libraries are installed, ssl pcre may exist (this library is installed by source code, online installation was not successful, prompt not to see this library) and other ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ this is the connection to this library. Download the source code and install it!
Then make
Make install
If the source code is used for installation, the installed directory is in/usr/local/nginx. some of them are started using the source code: sbin/nginx. This program is running in/usr/local/nginx.
For online installation, the default directory after installation is in/etc/init. d/nginx start
If you try it in your browser during the installation process !!
Install nginx on ubuntu10.04. After installation, start nginx and run the following command:
sudo /etc/init.d/nginxstart |
Error message:
hankcs@ubuntu:~$ sudo /etc/init.d/nginxstart[sudo] passwordfor hankcs: * Starting nginx nginx nginx: [emerg] bind() to [::]:80 failed (98: Address alreadyin use)nginx: [emerg] bind() to [::]:80 failed (98: Address alreadyin use)nginx: [emerg] bind() to [::]:80 failed (98: Address alreadyin use)nginx: [emerg] bind() to [::]:80 failed (98: Address alreadyin use)nginx: [emerg] bind() to [::]:80 failed (98: Address alreadyin use)nginx: [emerg] still could not bind() |
I checked the port usage and tried to kill the process:
hankcs@ubuntu:~$ netstat -ntpl(Not all processes can be detected. process information of all non-users is not displayed. To view all information, you must switch to the root user)Activate Internet connection (server only)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Programnametcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - hankcs@ubuntu:~$ killall -9 nginxNginx: no operation found |
In this case, I first searched for the answer in Chinese and found that everyone was loading the script to kill repeated nginx processes. I tried it and found it to be nonsense. So I read the first English page found by Google. A foreigner said that nginx first listened to port 80 of ipv4 and then listened to port 80 of ipv6, so it is occupied again. Even more difficult, you can see that the port is occupied and port 80 is released.
The solution is to edit the nginx configuration file.
hankcs@ubuntu:~$ sudo gedit /etc/nginx/sites-available/default |
Modify this section:
listen 80;listen [::]:80 default_server; |
Is
listen 80;listen [::]:80 ipv6only=on default_server; |
Start nginx and solve it perfectly!
Another possibility is that if nginx is installed on a VM, firefox in the VM may not be connected, but the browser in the host machine can be connected (the premise is that the host machine and the virtual machine can be connected !!!)