iso文件做web资源-nginx
- iso文件挂载。方法同挂载光驱。挂载到/media/cdrom即可。
mount -t iso9660 -o loop /opt/CentOS-7-x86_64-DVD-1511_7.2.iso /media/CentOS7/
- nginx配置cong/nginx.conf:
增加配置:
location /centos/ {
alias /media/cdrom;
autoindex on;
expires 1d;
}
修改配置最顶部
#user nobody;
修改为:
#user root owner;
autoindex 是自动列出目录。
user root owner; 解决403
不用nginx用Apache:
1 安装httpd :
yum install httpd
system start httpd #启动
system enable httpd # 开机自启动
systemctl start httpd.service #启动; stop则停止
systemctl enable httpd.service #开机启动
systemctl disable httpd.service #开机启动
2 在httpd服务的home中创建目录,将光盘挂载到此目录
mkdir /var/www/html/centos/7/os/x86_64/ -pv
mount /dev/sr0 / /var/www/html/centos/7/os/x86_64/
3 测试
http://your_ip/centos/
4 远程调用
vi /etc/yum.repos.d/test.repo
[test]
name=test
baseurl=http://your_ip/centos/7/os/x86_64
yum install tree
网友评论