在Linux系统中,可以通过以下几种方法检查Nginx是否已安装:
systemctl status nginx
active (running) 状态及版本信息。Unit nginx.service could not be found。nginx -v # 查看版本(快速验证是否存在)
nginx version: nginx/1.18.0。command not found。dpkg -l | grep nginx
rpm -qa | grep nginx
which nginx # 查找二进制文件路径
find / -name nginx 2>/dev/null # 全局搜索(可能需要sudo)
ps aux | grep nginx
nginx -v 或 systemctl status nginx 快速验证。dpkg 或 rpm 查询。bash
sudo apt install nginx # Debian/Ubuntu
sudo yum install nginx # RHEL/CentOSsudo。systemctl start nginx 启动服务。/usr/local/nginx/。