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

相关内容

热门资讯

9分钟了解!wepoker私人... 9分钟了解!wepoker私人局辅助器!其实是有辅助软件(有挂存在)-哔哩哔哩1、wepoker私人...
9分钟了解!最悠闲的辅助!确实... 9分钟了解!最悠闲的辅助!确实真的有辅助工具(有挂细节)-哔哩哔哩运最悠闲的辅助辅助工具,进入游戏界...
第三分钟了解!开心庄园辅助!一... 第三分钟了解!开心庄园辅助!一贯是真的有辅助工具(今日头条)-哔哩哔哩开心庄园辅助透视方法中分为三种...
第7分钟了解!全民比鸡bug!... 第7分钟了解!全民比鸡bug!其实真的有辅助教程(有挂透视)-哔哩哔哩进入游戏-大厅左侧-新手福利-...
六分钟了解!相约十三张辅助!一... 六分钟了解!相约十三张辅助!一直是有辅助攻略(有挂规律)-哔哩哔哩1、相约十三张辅助脚本辅助下载、相...
第七分钟了解!蜀山挂件辅助!都... 第七分钟了解!蜀山挂件辅助!都是一直都是有辅助攻略(有挂解惑)-哔哩哔哩1、玩家可以在蜀山挂件辅助透...
第一分钟了解!川南九九辅助!好... 第一分钟了解!川南九九辅助!好像存在有辅助方法(有挂方法)-哔哩哔哩一、川南九九辅助可以开透视的定义...
三分钟了解!杭州边锋辅助软件!... 三分钟了解!杭州边锋辅助软件!好像一直都是有辅助脚本(有挂详细)-哔哩哔哩1、点击下载安装,杭州边锋...
8分钟了解!手机游戏辅助器!本... 8分钟了解!手机游戏辅助器!本来是真的有辅助教程(有挂秘籍)-哔哩哔哩进入游戏-大厅左侧-新手福利-...
七分钟了解!贪玩娱乐科技!真是... 七分钟了解!贪玩娱乐科技!真是一直都是有辅助脚本(证实有挂)-哔哩哔哩1、超多福利:超高返利,海量正...