首页 新闻 会员 周边

虚拟机安装nginx和ftp,怎么映射到ftp服务器上?

0
悬赏园豆:10 [已解决问题] 解决于 2016-10-28 13:40

  在虚拟机上安装nginx和ftp,想做为图片服务,图片可以上传到ftp服务器上,怎么通过nginx的配置在浏览器中访问到图片?

截图如下:

注:nginx和ftp安装在同一个虚拟机里。ip:192.168.180.2

问题补充:

nginx.conf文件:

#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 192.168.180.2;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /home/ftpuser/taobao/;
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;
# }
#}

}

半夜起来敲代码的主页 半夜起来敲代码 | 菜鸟二级 | 园豆:257
提问于:2016-10-28 09:58
< >
分享
最佳答案
0

location{

root /ftp文件地址。你例子里面就是 /home/ftpuser/taobao/images

}

收获园豆:10
czd890 | 专家六级 |园豆:14412 | 2016-10-28 12:08

 

 

nginx.conf:

ftp:

 

nginx 访问成功

访问图片报404:

 

 

 

 

半夜起来敲代码 | 园豆:257 (菜鸟二级) | 2016-10-28 13:05

任然存在问题,麻烦你帮我看看,谢谢。

半夜起来敲代码 | 园豆:257 (菜鸟二级) | 2016-10-28 13:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册