1. 程式人生 > >關於通過http請求訪問Linux下的ftp的問題以及解決辦法

關於通過http請求訪問Linux下的ftp的問題以及解決辦法

今天在學習ssm商城的時候安裝好了虛擬機器,裝好了CentOS,配置好了NGINX伺服器,也配置好了Linux自帶的ftp,但是通過http訪問的時候卻不能實現。情況如下:

我使用的“FileZilla”工具訪問:


但是從網頁上就是不能夠訪問。

解決辦法:

1.首先進入到NGINX配置檔案下面:


然後繼續往下:


其中 “server_name”表示的是本機IP 也可設定成 “localhost”,“location”表

示本地的意思 。

先看根目錄“root  /home/ftpuser/hry/”表示的是根路徑,

“images”表示本地路徑。

區別 比如訪問路徑“http://192.168.64.128/home/ftpuser/hry/images”

設定了根路徑之後就可以更改為“http://192.168.64.128//images”

程式碼:

 server {
        listen       80;
        server_name  192.168.64.128;
        location / {
            root   html;
            index  index.html index.htm;
        }
        location /images/ {
            root   /home/ftpuser/hry/;
            autoindex on;
        }

還有一個就是檢視“ vi /etc/vsftpd.conf”配置如下,必須一致。

anonymous_enable=NO
# 禁止匿名使用者登陸
# Uncomment this to allow local users to log in.
local_enable=YES
 # 允許本地使用者登陸
# Uncomment this to enable any form of FTP write command.
write_enable=YES
 # 可以進行寫操作
# Default umask for local users is 077. You may wish to change this to 022,
#if your users expect that (022 is used by most other ftpd's)
local_umask=022
# 上傳檔案的許可權 預設沒有讀的許可權
# It is recommended that you define on your system a unique user which the
最後,感謝被我搜索過的文章,然後才總結出這一篇文章,謝謝!!!