一. 修改 ip 地址
1. 查看网卡一的 Mac 地址
cat /etc/udev/rules.d/70-persistent.NET.rules
2. 修改 ip 地址文件
- cd /etc/sysconfig/network-scripts/
- mv ifcfg-eth0 ifcfg-eth1
- vi ifcfg-eth1
编辑后的结果:
2. 修改 ip 地址文件
- DEVICE=eth1 // 把 eth0 修改为 eth1
- HWADDR=00:0c:29:33:b3:20 // 修改为网卡一的 Mac 地址
- TYPE=Ethernet
- UUID=0133d8eb-4c7c-4e04-b56e-4864782e35da
- ONBOOT=yes
- NM_CONTROLLED=no
- BOOTPROTO=dhcp
3. 重启网卡
service network restart
查看 ip
ifconfig
4.vi 命令
vi 文件名 -> i -> 修改内容 -> esc -> : -> wq/q!
二. 配置 Fastdfs
1. 修改 client.conf
vi /etc/fdfs/client.conf -> 把 ip 修改为当前虚拟机 ip
2. 修改 storage.conf
vi /etc/fdfs/storage.conf -> 把 ip 修改为当前虚拟机 ip
3. 启动 fastdfs
- service fdfs_trackerd start
- service fdfs_storaged start
4. 查看是否启动成功
netstat -unltp|grep fdfs
5. 查看监控信息
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
6. 启动 Nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
7. 关闭防火墙 / 开放防火墙 80 端口
- service iptables stop
- ?
- /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
- /etc/rc.d/init.d/iptables save
注意: 网络使用的是桥接模式
8. 测试 Nginx
在虚拟机里面: curl http://127.0.0.1:80
在宿主机测试: 浏览器访问 http://127.0.0.1:80
9. 测试上传
fdfs_test /etc/fdfs/client.conf upload /root/install.log
10. 测试预览
浏览器访问: fastdfs 返回的路径: 虚拟机 IP 地址
来源: http://www.bubuko.com/infodetail-3217235.html