实训日记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&

相关内容

热门资讯

微扑克透视挂!wepoker破... wepoker破解器有用吗AI 游戏攻略黑科技上线本地缓存功能,离线查阅能力开挂。提前下载对应游戏攻...
微扑克辅助!微扑克辅助下载,微... 微扑克辅助!微扑克辅助下载,微扑克科技透视(起初存在有辅助)主打本地运行的 AI 黑科技工具迎来新版...
wepoker透视挂!德普之星... wepoker透视挂!德普之星透视辅助软件是真的吗,wepoker透视软件下载(其实是有透视挂)AI...
德普之星辅助器!wepoker... AI 黑科技赛道又上新,这款智能处理工具堪称效率开挂,专门面向短视频创作者打造。它打通脚本撰写、AI...
wepoker辅助!wepok... 本地部署 AI 黑科技工具迎来新版本,不用上传文件到云端就能完成wepoker手机助手解析、 AI ...
微扑克透视挂!wepoker怎... 很多人使用云端 AI 时,都担心wepoker怎么获得好牌、内部资料上传带来隐私风险。这款本地运行的...
WPK透视挂!wepoker怎... WPK透视挂!wepoker怎么提高运气,WPK有没有辅助插件(原生真的有透视挂)主打本地运行的 A...
WPK辅助挂!wpk辅助软件,... AI 黑科技赛道又上新,这款智能处理工具堪称效率开挂,专门面向短视频创作者打造。它打通脚本撰写、AI...
德扑之星透视挂!wepoker... 『标题:当前标题』主打赛后复盘的 AI 游戏攻略黑科技走红,对局总结能力开挂。上传对局回放或者战绩截...
WPK辅助!wpk透视是真的假... 很多人使用云端 AI 时,都担心wpk透视是真的假的、内部资料上传带来隐私风险。这款本地运行的 AI...