# 更新软件包列表并安装必要的依赖项
sudo apt update
sudo apt install nginx
# 启动 Nginx 服务
sudo systemctl start nginx
# 设置 Nginx 开机自启动
sudo systemctl enable nginx
# 检查 Nginx 状态,确保其正在运行
sudo systemctl status nginx
# 配置防火墙以允许 HTTP 和 HTTPS 流量(如果启用了 UFW)
sudo ufw allow 'Nginx Full'
# 查看默认的 Nginx 配置文件路径和内容
cat /etc/nginx/nginx.conf
apt
安装 Nginx。systemctl
命令启动 Nginx 服务。如果你在其他发行版上安装 Nginx,命令可能会有所不同。上述代码适用于基于 Debian/Ubuntu 的 Linux 发行版。
上一篇:linux创建用户
下一篇:linux 重启
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站