网站首页 > 精选教程 正文
服务端
# 1、安装nfs-utils 和 rpcbind
# yum -y install nfs-utils rpcbind
# 2、创建要共享的目录(可能要一步一步的创建)
# mkdir /data/report/nfs
# 3、修改/etc/exports 10.111.74.247 不是本机ip,是要共享的ip,对谁开放就是谁
# /data/report/nfs 10.111.74.247(rw,no_root_squash)
#参数no_root_squash的其作用是:NFS客户端使用共享目录的用户,如果是root 的话,所有的操作均在服务器端映射为root用户,拥有共享目录的root权限!
# 4、开启nfs
# systemctl start nfs
# 5、如果报错,可能要先开启rpcbind
# systemctl start rpcbind
# 6、查看共享目录
# showmount -e localhost
# 7、设置开机自启动
# systemctl enable rpcbind
# systemctl enable nfs-server.server
客户端
# 客户端安装在另外一台机器上,就是对谁开放的那个谁
# 1、安装nfs-utils
# yum -y intall nfs-utils
# 2、显示服务端可挂载的目录
# showmount -e 10.111.74.248
# 这个IP是服务端的IP
# 3、将服务端的/data/report/nfs 挂载到本地的 /data/report/nfs。实际上是互相共享,无论修改哪一边,另外一边也会相应的被修改
# mount -t nfs 10.111.74.248:/data/report/nfs /data/report/nfs
# 设置开机自动挂载
# vi /etc/fstab
# 这个IP是服务端的IP
# 10.111.74.248:/data/report/nfs/ /data/report/nfs/ nfs defaults,_rnetdev 1 1
文件服务器
# 一、安装PCRE
#
# 文档:菜鸟教程 https://www.runoob.com/linux/nginx-install-setup.html
# 安装编译工具及库文件
# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
# 首先要安装 PCRE PCRE 作用是让 Nginx 支持 Rewrite 功能。
# cd /usr/local/src/
# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
# 解压
# tar zxvf pcre-8.35.tar.gz
# 进入安装包目录
# cd pcre-8.35
# ./configure
# make && make install
# 查看pcre版本
# pcre-config --version
# 二、安装Nginx
# cd /usr/local/src/
# wget http://nginx.org/download/nginx-1.6.2.tar.gz
# tar zxvf nginx-1.6.2.tar.gz
# 进入安装包目录
# cd nginx-1.6.2
# 编译安装
# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
# make
# make install
# 查看nginx版本
# /usr/local/webserver/nginx/sbin/nginx -v
# 修改配置文件
vi /etc/nginx/conf.d/default.conf
# 内容
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# 添加这个
location ~ ^/report/ {
root /data;
#autoindex on;
}
# 添加这个
location ^~/opt/{
alias /data/report/nfs/opt/;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
# }
# 就可以以ip的形式访问这个目录下的文件
# 例如: http://10.111.74.248/data/report/nfs/xxx/xxx.txt
# 例如: http://10.111.74.248:80/data/report/nfs/xxx/xxx.txt
# 非80 端口号监听
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://192.168.1.100:8081;
proxy_set_header Host $host:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- 上一篇: Java Web应用开发工程师——学习路线
- 下一篇: 同事向我展示他的代码是怎么工作的
猜你喜欢
- 2024-10-24 Nodejs安装和测试 nodejs最新版安装教程
- 2024-10-24 盘点腾讯后台开发各级工程师(T1-T9)需要具备哪些能力
- 2024-10-24 开源资产管理系统 开源资产管理系统 web
- 2024-10-24 LINUX安装通达OAv12的操作教程 通达oa流程详细教程
- 2024-10-24 同事向我展示他的代码是怎么工作的
- 2024-10-24 Java Web应用开发工程师——学习路线
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- nginx反向代理 (57)
- nginx日志 (56)
- nginx限制ip访问 (62)
- mac安装nginx (55)
- java和mysql (59)
- java中final (62)
- win10安装java (72)
- java启动参数 (64)
- java链表反转 (64)
- 字符串反转java (72)
- java逻辑运算符 (59)
- java 请求url (65)
- java信号量 (57)
- java定义枚举 (59)
- java字符串压缩 (56)
- java中的反射 (59)
- java 三维数组 (55)
- java插入排序 (68)
- java线程的状态 (62)
- java异步调用 (55)
- java中的异常处理 (62)
- java锁机制 (54)
- java静态内部类 (55)
- java怎么添加图片 (60)
- java 权限框架 (55)
本文暂时没有评论,来添加一个吧(●'◡'●)