centos7 nginx图片 服务器可以访问ftp用户上传的图片资源的配置
注:本文参考了csdn:JAVA_DIRECTION的《nginx和ftp搭建图片服务器》一文。在实践中其文在centos7中还是存在缺陷性的
一:前提条件:是成功的安装好了ftp服务器和nginx服务器;如果没有安装敬请参考《CentOS7 搭建FTP服务器》和 《centos7_ linux : Nginx安装手册》
二:开放ftpuser用户主目录的其他用户的访问权限:
[root@localhost home]# chmod -R 777 ftpuser/

三:设置nginx配置文件中的访问路径
1:进入配置文件的目录:
cd /usr/local/nginx/conf/
2;nginx的默认配置文件nginx.config
#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
} #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 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;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
三:配置图片服务器
方法一、在配置文件server{}中location /{} 修改配置:
#默认请求
location / {
root /home/ftpuser/www;#定义服务器的默认网站根目录位置
index index.html index.php index.htm;#定义首页索引文件的名称
}
其中:/home/ftpuser/www;为创建FTP服务账户ftpuser的根目录下的www目录
注:如果是按照我提供的参考《CentOS7 搭建FTP服务器》和 《centos7_ linux : Nginx安装手册》操作步骤进行操作的的后,用ftp上传图片到服务器后,重启nginx服务器;
在用浏览器直接访问应该能看到图片信息;


centos7 nginx图片 服务器可以访问ftp用户上传的图片资源的配置的更多相关文章
- Linux 终端访问 FTP 及 上传下载 文件
今天同事问我一个问题,在Linux 下访问FTP,并将文件上传上去. 我之前一直是用WinSCP工具的. 先将文件从linux copy到windows下,然后在传到ftp上.google 一下. 方 ...
- Linux 终端访问 FTP 及 上传下载 文件[转]
1. Linux 终端连接FTP [oracle@Dave ~]$ ftp 10.85.7.97 Connected to 10.85.7.97. 220 Serv-U FTP Server ...
- Django之用户上传文件的参数配置
Django之用户上传文件的参数配置 models.py文件 class Xxoo(models.Model): title = models.CharField(max_length=128) # ...
- 04_安装Nginx图片服务器
一.安装Nginx 先安装Nginx,看我之前发的文章: 搭建Nginx服务器 二.安装vsftpd 再安装vsftpd组件,看我之前发的文章: Linux安装ftp组件 三.开始搭建Nginx图片服 ...
- 【图片服务器】搭建Nginx图片服务器
一.安装Nginx 二.安装vsftpd 三.开始搭建Nginx图片服务器 1.效果 例如:图片通过ftp服务上传到/home/ftpuser/www/images目录下,我想通过访问Nginx服务器 ...
- Nginx 图片服务器
文件服务器:后台如果是集群,每次请求都会到不同的服务器,所以每台服务器的图片文件等都要做同步处理,才能保证每次用户不管访问到哪台服务器都能获取一样的资源.这种做法开销会很大,专门使用 nginx 作为 ...
- Windows下搭建Nginx图片服务器
在项目最开始,上传图片的时候,服务器先保存原图再使用ImageMagick生成上传图片缩略图,这种方法有很多缺点,例如生成的缩略图的大小是固定的,不能动态请求指定大小的缩略图. 虽然有非常多的图片云存 ...
- 搭建Nginx图片服务器
搭建Nginx图片服务器 Part-I 安装Nginx 安装PCRE 下载 ngx_cache_purge 并解压,用来清除缓存 下载Nginx并解压 cd nginx-1.7.7 编译,--pref ...
- 第一次项目上Linux服务器(八:——搭建Nginx图片服务器)
一.准备工作 安装Nginx,参考历史博客 二.搭建Nginx图片服务器 1.效果 例如:图片通过xftp服务上传到/home/java/upload目录下,我想通过访问Nginx服务器来访问xftp ...
随机推荐
- 导入numpy时,出错怎么解决?
在linux中导入numpy时出错,出现如下图所示的问题,采用更新版本的问题并未解决, 解决方法如下:进入文件夹中,删除其中的numpy文件夹,其他的文件夹不动,然后重新安装numpy即可
- js apply使用
js中apply方法的使用 1.对象的继承,一般的做法是复制:Object.extend prototype.js的实现方式是: Object.extend = function(destinati ...
- CF 1060E. Sergey and Subway
题目链接 题意:给你一棵树,然后连接两个有公共邻居的点,问你连完后,任意两点的距离之和. 一开始看这种题,还不怎么会做,借鉴了这位大佬的博客,get到了新技能,当我们求树上任意俩点的距离之时,可以转化 ...
- 5-23 CSS知识的补充
1,后代选择器 使用空格表示后代选择器.顾名思义,父元素的后代(包括儿子,孙子,重孙子). <!DOCTYPE html> <html lang="en"> ...
- aplication.properties配置
1.设置使用的properties文件 spring.profiles.active=dev 设置激活使用哪个properties一般设置两个,一个是开发环境的,一个是本地的测试环境 可设置默认使用开 ...
- LOJ #2527 Luogu P4491「HAOI2018」染色
好像网上没人....和我推出....同一个式子啊..... LOJ #2527 Luogu P4491 题意 $ n$个格子中每个格子可以涂$ m$种颜色中的一种 若有$ k$种颜色恰好涂了$ s$格 ...
- PTA 逆散列问题 (30 分)(贪心)
题目链接:https://pintia.cn/problem-sets/1107178288721649664/problems/1107178432099737614 题目大意: 给定长度为 N 的 ...
- mysql 原理 ~ redo
一 简介:redo log二 文件 ib_logfile0 ib_logfile1 两个redo log 默认为一组 循环覆盖写入三 相关参数 innodb_log_file_size=256 ...
- 0326 iframe和video experience
今天的东西确实不少,很容易混淆,input下的属性太多,form下的属性也不少,内容多点,一时不能熟练掌握,晚上多拿出点时间练练 尤其是 form 和inpu那些属性格外别扭 下午的内嵌视频相对简单主 ...
- python - 代码练习 - 差异备份/同步更新
差异备份以及文件同步: import os import filecmp import shutil import re # 差异增量更新,dir2 文件目录 与 dir1 文件目录更新, def a ...