实训日记day18
创始人
2024-11-12 06:08:26
0

基于域名和IP地址的虚拟机主机 线上静态商城

将原有的nginx.conf文件备份
[root@static ~]# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak[root@static ~]# grep -Ev "#|^$" /usr/local/nginx/conf/nginx.conf > /usr/local/nginx/conf/nginx.conf
基于域名的虚拟主机
修改配置文件[root@static ~]# vim /usr/local/nginx/conf/nginx.conf创建目录[root@static ~]# mkdir /aaa在/aaa目录下创建index.html文件[root@static ~]# echo "hello,I am aaa" > /aaa/index.html[root@static ~]# cat /aaa/index.html hello,I am aaa配置nginx.conf文件[root@static ~]# vim /usr/local/nginx/conf/nginx.conf[root@static ~]# /usr/local/nginx/sbin/nginx[root@static ~]# /usr/local/nginx/sbin/nginx -s reload主机劫持IP [root@static ~]# curl www.aaa.com I am static server
将刚才配置的server模块保存到一个新的文件中
[root@static ~]# mkdir /usr/local/nginx/conf.d/[root@static ~]# sed -n '34,40p' /usr/local/nginx/conf/nginx.conf > /usr/local/nginx/conf.d/aaa.conf[root@static ~]# cat /usr/local/nginx/conf.d/aaa.conf    server{        listen    80;        server_name    www.aaa.com;        location / {            index    index.html;        }    }[root@static ~]# sed -i '34,40d' /usr/local/nginx/conf/nginx.conf[root@static ~]# /usr/local/nginx/sbin/nginx -s reload[root@static ~]# /usr/local/nginx/sbin/nginx -s reload[root@static ~]# vim /usr/local/nginx/conf/nginx.conf[root@static ~]# /usr/local/nginx/sbin/nginx -s reload
使用IP地址访问不同的虚拟主机
创建新的IP挂载这个网卡上[root@static ~]# ifconfig ens33:1 192.168.8.200修改配置文件[root@static ~]# vim /usr/local/nginx/conf/nginx.conf[root@static ~]# vim /usr/local/nginx/conf.d/aaa.conf[root@static ~]# /usr/local/nginx/sbin/nginx -s reload [root@static ~]# vim /usr/local/nginx/conf.d/aaa.conf[root@static ~]# /usr/local/nginx/sbin/nginx -s reload
上线一个静态的前端系统
在安装nodejs之前检查是否安装epel[root@static ~]# yum list installed | grep epel[root@static ~]# yum -y install epel-release安装nodejs(是个运行环境)[root@static ~]# yum -y install nodejs

[root@static ~]# node -v v16.20.2 安装npm(nodejs 的包管理器)[root@static ~]# yum -y install npm[root@static ~]# npm -v8.19.4安装vue[root@static ~]# npm config set registry https://registry.npmmirror.com[root@static ~]# npm install @vue/cli[root@static ~]# find / -name "vue"/root/node_modules/vue/root/node_modules/.bin/vue[root@static ~]# /root/node_modules/.bin/vue -V@vue/cli 5.0.8创建vue项目[root@static ~]# /root/node_modules/.bin/vue create eleme_web[root@static ~]# cd eleme_web/[root@static eleme_web]# npm run serve

[root@static eleme_web]# nohup npm run serve& [1] 3130 [root@static eleme_web]# npm run servehttp://192.168.8.159:8082/
配置samba
[root@static eleme_web]# yum -y install sambasamba文件位置编辑配置文件[root@static eleme_web]# pwd/root/eleme_web[root@static eleme_web]# vim /etc/samba/smb.conf创建用户[root@static eleme_web]# useradd vueediter[root@static eleme_web]# smbpasswd -a vueediterNew SMB password:123Retype new SMB password:123Added user vueediter.为该用户在文件夹中添加读写权限[root@static eleme_web]# setfacl -m u:vueediter:rwx /root/eleme_web/启动服务[root@static eleme_web]# systemctl start nmb[root@static eleme_web]# systemctl start smb[root@static eleme_web]# mkdir public/img[root@static eleme_web]# mkdir public/video[root@static eleme_web]# mkdir public/music部署nfs服务器[root@elemestatic ~]# yum -y install rpcbind.x86_64[root@elemestatic ~]# yum -y install nfs-utils.x86_64[root@elemestatic ~]# vim /etc/exports/static/img     *{rw,sync}[root@elemestatic ~]# mkdir -p /static/img/[root@elemestatic ~]# systemctl start rpcbind[root@elemestatic ~]# systemctl start nfs[root@static eleme_web]# yum -y install nfs-utils.x86_64[root@static eleme_web]# mount -t nfs 192.168.8.161:/static/img public/img/[root@tomcat src]# cd components/[root@tomcat components]# lsHelloWorld.vue[root@tomcat components]# vim HelloWorld.vue[root@tomcat src]# ls views/[root@tomcat src]# vim views/HomeView.vue[root@tomcat eleme_web]#nohup npm run serve&

相关内容

热门资讯

绝活儿辅助!广西老友玩老是输怎... 绝活儿辅助!广西老友玩老是输怎么办(辅助挂)都是真的有辅助app(讲解有挂)在进入广西老友玩老是输怎...
法门辅助!福建13水插件(辅助... 法门辅助!福建13水插件(辅助挂)一贯是有辅助技巧(有挂技术)1、许多玩家不知道福建13水插件辅助怎...
办法辅助!潮友会app下载官方... 办法辅助!潮友会app下载官方辅助器(辅助挂)真是真的是有辅助app(有挂教程)该软件可以轻松地帮助...
妙招辅助!邯郸胡乐挂辅助(辅助... 妙招辅助!邯郸胡乐挂辅助(辅助挂)好像存在有辅助插件(有挂方略)1、上手简单,内置详细流程视频教学,...
教程书辅助!乐酷辅助(辅助挂)... 教程书辅助!乐酷辅助(辅助挂)其实存在有辅助脚本(有挂细节)乐酷辅助能透视中分为三种模型:乐酷辅助模...
学习辅助!决战卡五星辅助(辅助... 学习辅助!决战卡五星辅助(辅助挂)本来真的是有辅助软件(有人有挂)学习辅助!决战卡五星辅助(辅助挂)...
绝活辅助!边锋嘉兴麻将辅助器(... 绝活辅助!边锋嘉兴麻将辅助器(辅助挂)真是真的有辅助神器(新版有挂)1、边锋嘉兴麻将辅助器公共底牌简...
举措辅助!枫叶辅助器(辅助挂)... 举措辅助!枫叶辅助器(辅助挂)本来存在有辅助技巧(竟然有挂)1、下载好枫叶辅助器正确养号方法之后点击...
讲义辅助!点我达辅助(辅助挂)... 讲义辅助!点我达辅助(辅助挂)一直存在有辅助技巧(有人有挂)1、点我达辅助辅助器安装包、点我达辅助辅...
模块辅助!威信茶馆有挂的吗(辅... 模块辅助!威信茶馆有挂的吗(辅助挂)一直真的是有辅助脚本(揭秘有挂)1、玩家可以在威信茶馆有挂的吗线...