Ubuntu16.04安装nginx

1.安装

sudo apt-get install nginx

2.启动

systemctl start nginx.service

如果和apache2的80端口冲突了,修改一下apache2的port

sudo vim /etc/apache2/ports.conf

冲突的话,日志/var/log/nginx/error.log中将会报

2019/10/12 14:25:31 [emerg] 23836#23836: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)

修改成8080

重启apache2

systemctl restart apache2

再启动nginx,成功

原文地址:https://www.cnblogs.com/tonglin0325/p/11662535.html