Recently, I feel like I haven’t been exposed to lnmp development environment setup, configuration, etc. for a long time. As a result, sometimes I can’t remember when using it, so I configure the configuration environment separately and practice
I first tried to install it with apt-get install nginx, but a very strange error occurred, causing apt-get remove nginx to also fail. Finally, I passed
find / -name '*nginx*' | xargs rm -rf
Deleted all the nginx files, but the reinstallation still failed. I temporarily gave up the apt-get installation method and used 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
when I An error occurred during startup
<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>
It may be because the previous apt-get installation failed, or other programs occupy this port. Kill the program occupying this port
sudo fuser -k 80/tcp
Restart , no problem
/etc/init.d/nginx
But when I run /etc/init.d/nginx stop
, something goes wrong again, invalid stop. I am very confused, how to stop nginx? I just use this
killall -9 nginx
and it’s done. When starting, just /etc/init.d/nginx
and it’s ok. When stopping, just killall -9 nginx
Then the browser runs localhost: 80 Done
The above introduces the installation of nginx on ubuntu, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.