22 lines
420 B
Bash
22 lines
420 B
Bash
#!/bin/bash
|
|
|
|
# 创建thttpd配置文件
|
|
sudo tee /etc/thttpd.conf << EOF
|
|
port 8080
|
|
user www-data
|
|
logfile /var/log/thttpd.log
|
|
pidfile /var/run/thttpd.pid
|
|
chroot /
|
|
docroot /var/www
|
|
cgipat /cgi-bin/*
|
|
EOF
|
|
|
|
# 创建必要的目录
|
|
sudo mkdir -p /var/www/cgi-bin
|
|
sudo chown -R www-data:www-data /var/www
|
|
|
|
# 重启thttpd服务
|
|
sudo systemctl restart thttpd
|
|
|
|
echo "thttpd configured and restarted. Service running on port 8080"
|