V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
cczuysh
V2EX  ›  iDev

ftp 上的文件怎么才可以用 http 访问呢

  •  
  •   cczuysh · 2015-08-31 18:26:42 +08:00 · 6908 次点击
    这是一个创建于 3132 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在阿里云上弄了个 ftp 服务器,传上去的文件 ftp://123.96.789.131/buyer/1/0/photo_cache100.jpg 可以访问,http 是不行的,我想要用 http 访问,需要怎么做呢?
    18 条回复    2015-09-01 14:26:51 +08:00
    abelyao
        1
    abelyao  
       2015-08-31 19:00:48 +08:00
    加个 HTTP 服务器把目录指定到 FTP 相同目录
    abelyao
        2
    abelyao  
       2015-08-31 19:01:16 +08:00
    上面有歧义,应该是加个 HTTP 服务
    zixianlei
        3
    zixianlei  
       2015-08-31 19:06:25 +08:00
    要绑定域名吧。。
    alexapollo
        4
    alexapollo  
       2015-08-31 19:07:23 +08:00
    python3 -m http.server
    jimzhong
        5
    jimzhong  
       2015-08-31 19:09:52 +08:00
    装一个 HTTP 服务,比如 lighttpd , apache 等等
    最简单的就是 python3 -m http.server
    lilydjwg
        6
    lilydjwg  
       2015-08-31 19:11:39 +08:00
    @jimzhong @alexapollo 然后楼主再跑来说怎么用的人多了就卡在那里不动了呢 =w=
    临时跑 Web 服务的话可以选用 darkhttpd 或者 webfsd 的哟~
    gamexg
        7
    gamexg  
       2015-08-31 19:25:03 +08:00
    除了上面的操作还需要备案
    br00k
        8
    br00k  
       2015-08-31 19:36:08 +08:00
    弄 nginx 吧
    stupil
        9
    stupil  
       2015-08-31 19:51:40 +08:00
    现在用的是什么 ?
    zodiac1111
        10
    zodiac1111  
       2015-08-31 19:58:37 +08:00
    webfsd
    cczuysh
        11
    cczuysh  
    OP
       2015-09-01 09:47:49 +08:00
    @br00k 弄 nginx 吧,这个安装了,现在也可以访问,域名也有,其他的怎么操作还不会呢
    cczuysh
        12
    cczuysh  
    OP
       2015-09-01 09:48:48 +08:00
    Welcome to nginx on Fedora!

    This page is used to test the proper operation of the nginx HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly.

    This is the default index.html page that is distributed with nginx on Fedora. It is located in /usr/share/nginx/html.

    You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.

    然后怎么操作呢
    cczuysh
        13
    cczuysh  
    OP
       2015-09-01 09:53:04 +08:00
    Apache Tomcat/8.0.24 安装了, If you're seeing this, you've successfully installed Tomcat. Congratulations!, HTTP 服务器把目录指定到 FTP 相同目录这个怎么操作呢
    cczuysh
        14
    cczuysh  
    OP
       2015-09-01 10:24:23 +08:00
    我在 cd /usr/share/nginx/html 这个目录下面建了一个文件夹 apps ,
    然后再这里加了个映射 vi /etc/nginx/nginx.conf

    location /apps/ {
    root /var/public_ftp;
    #alias ;
    autoindex on;
    #autoindex_exact_size off;
    #autoindex_localtime on;
    }

    添加用户和访问权限,然后就 403 了

    useradd -d /var/public_ftp -M appImage
    chown appImage /var/public_ftp
    chmod 777 -R /var/public_ftp
    ys0290
        15
    ys0290  
       2015-09-01 11:14:03 +08:00 via iPhone
    web 默认配置啥也不用干,把 ftp 目录软链接到 web 目录下,删掉 index 文件
    cczuysh
        16
    cczuysh  
    OP
       2015-09-01 11:19:25 +08:00
    @ys0290 这个什么意思呢,我现在图片在 /var/public_ftp 这个目录下 ,
    cczuysh
        17
    cczuysh  
    OP
       2015-09-01 11:20:48 +08:00
    @ys0290 我查了 403 应该是权限不够,我用 root 用户,然后把 /var/public_ftp 这个目录 /var 都 chmod 777 了 还是报 403.
    tanyuxiang
        18
    tanyuxiang  
       2015-09-01 14:26:51 +08:00 via Android
    ftp 和 web 统一用一个用户
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3307 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:32 · PVG 21:32 · LAX 06:32 · JFK 09:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.