Ir al contenido

安装文档:OWASP Juice Shop

环境:Ubuntu Server 技术:Node.js + Express + Angular

0阅读

环境:Ubuntu Server 技术:Node.js + Express + Angular

OWASP Juice Shop 需要现代版本的 Node.js(v18 或更高版本)。我们将安装版本 22。

Ventana de terminal
sudo apt update
curl -fsSL [https://deb.nodesource.com/setup_22.x](https://deb.nodesource.com/setup_22.x) | sudo -E bash -
sudo apt install -y nodejs
# Verificar versión
node -v
# Debe ser v20+
Ventana de terminal
cd /var/www/html
sudo git clone [https://github.com/juice-shop/juice-shop.git](https://github.com/juice-shop/juice-shop.git)
cd juice-shop

这一步至关重要。如果失败,服务器将无法启动(错误 CONNECTION_REFUSED)。需要以写权限执行 npm install,以生成 build 文件夹。

Ventana de terminal
# 1. Asignar propiedad a tu usuario actual para poder compilar
sudo chown -R $USER:$USER /var/www/html/juice-shop
# 2. Instalar dependencias y compilar la aplicación
npm install
# 3. Devolver la propiedad al usuario web (seguridad)
sudo chown -R www-data:www-data /var/www/html/juice-shop

OWASP Juice Shop 不是系统服务(如 Apache),而是我们需要在终端中保持运行的 Node.js 进程。

Ventana de terminal
cd /var/www/html/juice-shop
sudo -u www-data npm start

我们会等待直到看到消息:info: Server listening on port 3000

Web 访问:http://TU_IP:3000

在正在运行的终端中,我们将按下: Ctrl + C