ubuntu 安装 nginx

  1. 安装:
sudo apt-get install nginx
  1. 启动:
sudo /etc/init.d/nginx start
  1. 出错:

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

  1. 修改:
        listen 80 default_server;
        listen [::]:80 default_server;

===>

listen 80;
listen [::]:80 ipv6only=on default_server;
  1. 测试:
root@ubuntu:/etc/nginx/sites-available# sudo /etc/init.d/nginx start
[ ok ] Starting nginx (via systemctl): nginx.service.

你可能感兴趣的:(ubuntu 安装 nginx)