【直播录屏】4.0.1-62 PRO更新
录屏地址:https://www.bilibili.com/video/BV14Q4y1Q7mp?spm_id_from=333.999.0.0视频演示中遇到的docker创建web服务器问题使用以下正确预配,cookbook里边不能直接复制,需要改动格式
# Set ip address and Default route
ip addr add 10.1.1.100/24 dev eth0 || true
ip route add default via 10.1.1.254 || true
# Set DNS server
cat > /etc/resolv.conf << EOF
nameserver 8.8.8.8
EOF
# Create a Default web page
# Use 'EOF' do avoid variable from expanding
# Delete default index page
rm /var/www/html/index.html || true
# Create a Default web page
# Use 'EOF' do avoid variable from expanding
cat > /var/www/html/index.php << 'EOF'
<center>
<?php
echo gethostname();
?>
<hr>
<imgwidth="596" height="239"src="data:image/png;base64,---imagecode ommittedg==">
<hr>
<?php
//whether ip is from share internet
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
}
//whether ip is from proxy
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
//whether ip is from remote address
else
{
$ip_address = $_SERVER['REMOTE_ADDR'];
}
echo 'Client Address:'.$ip_address;
?>
</center>
EOF
谢谢分享,好好学习
页:
[1]