赞
踩
# 第一步mkdir /zhangmin
# 第二部echo "i am zhangmin" > /zhangmin/index.html
# 第三步vim /usr/local/nginx/conf/nginx.conf
# 第三步http{server{listen 80 ;root /zhangmin;server_name www.zhangmin.com;location /{index index.html;}}server{...}}
# 第四步vim /etc/hosts######################10 .1.1.10 www.zhangmin.com########################curl www.zhangmin.com
一个 nginx 服务器中有多个 server 的时候是非常难于管理的,我们会将每一个server 单独创建一个文件保存,在主配置文件使用 includemkdir /usr/local/nginx/conf.d/touch /usr/local/nginx/conf.d/zhangmin.confsed -n 'server 的行号 p' /usr/local/nginx/conf/nginx.conf > ..../zhangmin.confsed -i 'server 的行号 d' /usr/local/nginx/conf/nginx.confvim /usr/local/nginx/conf/nginx.conf================include /usr/local/nginx/conf.d/*.conf/usr/local/nginx/sbin/nginx -s rdlaod
为网卡添加一个新的 ip 地址ifconfig ens33:1 10.1.1.11
server{listen 80;server_name 10.1.1.10;root /zhangmin;location /{index index.html;}}server{listen 80;servername 10.1.1.11;root html;location /{index index.html;}基于端口配置 server 80,可以省略,一般来说基于端口的配置,用于企业内部的项目测试server{listen 80;server_name 10.1.1.10;.....}server{listen 8080;server_name 10.1.1.10;.....}systemctl stop firewalldfirelwall-cmd --zone=public --add-ports=8080/tcp --permament && firewall-cmd --reload;
第一台主机
- [root@zhu ~]# yum list installed | grep epel
- epel-release.noarch 7-11 @extras
-
- [root@zhu ~]# yum -y install nodejs
- [root@zhu ~]# node -v
- v16.20.2
-
- [root@zhu ~]# yum -y install npm
- [root@zhu ~]# npm -v
- 8.19.4
- [root@zhu ~]# npm config set registry https://registry.npmmirror.com
- [root@zhu ~]# npm install @vue/cli
-
- [root@zhu ~]# find / -name "vue"
- /root/node_modules/vue
- /root/node_modules/.bin/vue
-
- [root@zhu ~]# ls -l /root/node_modules/.bin/vue
- lrwxrwxrwx. 1 root root 22 7月 31 14:47 /root/node_modules/.bin/vue -> ../@vue/cli/bin/vue.js
-
- [root@zhu ~]# /root/node_modules/.bin/vue -V
- @vue/cli 5.0.8
[root@zhu ~]# /root/node_modules/.bin/vue create eleme_web
[root@zhu ~]# cd /root/eleme_web/
- [root@zhu eleme_web]# yum -y install samba
-
- [root@zhu eleme_web]# pwd
-
- /root/eleme_web
- [root@zhu eleme_web]# vim /etc/samba/smb.conf
-
- ……
-
- [eleme_web]
-
- comment = daning
-
- path = /root/eleme_web
-
- guest ok = no
-
- writable = yes
- [root@zhu eleme_web]# useradd vueediter
-
- [root@zhu eleme_web]# smbpasswd -a vueediter
-
- New SMB password:
-
- Retype new SMB password:
-
- Added user vueediter.
-
- [root@zhu eleme_web]# setfacl -m u:vueediter:rwx /root/eleme_web/
- [root@zhu eleme_web]# systemctl restart nmb.service
-
- [root@zhu eleme_web]# systemctl restart smb.service
- [root@zhu eleme_web]# mkdir public/img
-
- [root@zhu eleme_web]# mkdir public/video
-
- [root@zhu eleme_web]# mkdir public/music
-
- [root@zhu eleme_web]# tree public/
-
- public/
- ├── favicon.ico
- ├── img
- ├── index.html
- ├── music
- └── video
-
- 3 directories, 2 files
-
- [root@zhu eleme_web]#
- [root@zhu eleme_web]# yum -y install nfs-utils.x86_64 nfs4-acl-tools.x86_64
-
- [root@zhu eleme_web]# mount -t nfs 192.168.110.21:/static/img public/img/
第二台主机
- [root@cong ~]# vim /etc/exports
-
- /static/img *(rw,sync)
[root@cong ~]# mkdir -p /static/img/
- [root@cong ~]# systemctl restart rpcbind.service
-
- [root@cong ~]# systemctl restart nfs
- [root@cong ~]# netstat -lnput | grep rpcbind
-
- tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1797/rpcbind
-
- tcp6 0 0 :::111 :::* LISTEN 1797/rpcbind
-
- udp 0 0 0.0.0.0:111 0.0.0.0:* 1797/rpcbind
-
- udp 0 0 0.0.0.0:700 0.0.0.0:* 1797/rpcbind
-
- udp6 0 0 :::111 :::* 1797/rpcbind
-
- udp6 0 0 :::700 :::* 1797/rpcbind
-
- [root@cong ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。