FTP服务器配置http访问(配置nginx+ftp服务器)

您所在的位置:网站首页 浏览器不能访问FTP FTP服务器配置http访问(配置nginx+ftp服务器)

FTP服务器配置http访问(配置nginx+ftp服务器)

2024-07-16 10:51| 来源: 网络整理| 查看: 265

一、搭建nginx服务器

先安装nginx服务器

# yum install nginx -y

启动nginx服务

# systemctl start nginx

浏览器访问:http://192.168.1.55/

二、搭建FTP服务器

安装ftp服务

# yum install vsftpd -y

启动ftp服务

# systemctl start vsftpd

三、修改nginx配置文件

配置文件位于:/etc/nginx/nginx.conf,里面可以修改处理器数量、日志路径、pid文件路径等,默认的日志:

错误日志 /var/log/nginx/error.log 访问日志 /var/log/nginx/access.log

在nginx.conf末尾有一句:include /etc/nginx/conf.d/*.conf;  推荐把用户自己的配置放到conf.d/

下面把默认的server修改为一个简单的文件服务器

# vi /etc/nginx/nginx.conf

user root; worker_processes 1; #error_log /var/log/nginx/error.log; #pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. #include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { 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 /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root /var/ftp/pub/; autoindex on; # 显示目录 autoindex_exact_size off; # 显示文件大小 #默认为on显示出文件的确切大小,单位是bytes          #改为off后,显示出文件的大概大小,单位是kB或者MB或者GB autoindex_localtime on; # 显示文件时间 #默认为off,显示的文件时间为GMT时间 #改为on后,显示的文件时间为文件的服务器时间 charset utf-8,gbk; #解决中文乱码问题 } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } # Settings for a TLS enabled server. # # server { # listen 443 ssl http2 default_server; # listen [::]:443 ssl http2 default_server; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /40x.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # } }

重新启动nginx

# systemctl restart nginx

浏览器访问:http://192.168.1.55/

四、修改FTP配置文件

参考我的另一篇文章

配置允许匿名用户登录访问vsftpd服务,进行文档的上传下载、文档的新建删除等操作

参考博客:

通过http协议访问FTP服务器的搭建,ftp+nginx 图片服务器搭建之后使用http访问进行配置文件的修改

https://blog.csdn.net/weixin_41619143/article/details/91357577

通过HTTP服务访问FTP服务器文件(配置nginx+ftp服务器)

https://blog.csdn.net/qq_37725650/article/details/80726828



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3