简体   繁体   中英

Stream .mp4 file from CentOS server via php

I have a few videos i want to stream on my website and for that i want to rent my own VPS / Dedicated server.

Because my videos will be about 20/30 min long / 300MB each i want to be prepared for a lot of views/traffic.

I think the best thing i could do is rent a VPS and maybe later on a dedicated server to ensure fast speeds and no problem handling all my traffic. Though i am not sure how to set this up.

I got my website running via a host. On my website users can watch the videos. Of course i can't just put them on my web host so that's where the vps / dedicated comes into play.

I don't have any experience with VPS other than a windows VPS / Directadmin pre-installed.

Now i want to know what the best set-up should be so that i can:

  1. Upload my video files to the VPS
    1. Stream the videos on my (php) website.

The website is done already with a nice HTML 5 player. If i enter the source aka link to the video it will play the video as it should.

So that brings me to the question. Can i upload .mp4 files to a CentOS server and let PHP stream those files ( so this would be 2 seperate servers )? And if yes, how would i be able to do that? Does a VPS also have some kind of IP address with mapping or something? Or should i install php / apache on the VPS to access the files?

Or should i host my website on the same server as the videos? In that case i could simply install directadmin and upload the website/files to it. Right? Yet i would like to keep those 2 seperated.

I would really love some advice!

Thanks in advance.

php stream ?! it's not correct. You don't neet use php to send your video stream. And you can play videos hosting on different server without problems.

You must use dedicated server + nginx (not apache because apache isn't very good to send file/video stream)

My advice is:

  • Centos 7 on dedicated server
  • Nginx
  • Set on your player direct link of your video.

    example:

      <video width="1028" height="720" controls><source src="http://fileServerDomain.com/path/video/myvideo.mp4" type="video/mp4"> </video> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM