Welcome to My iptv forum

  • Everyone is invited! My iptv forum is for everyone, new and advanced user alike!
  • Searching is key! Before you post a question, use the forum search feature to determine whether your topic has already been covered.
  • Do not start flame wars! If someone has engaged in behavior that is detrimental to the discussion -- spamming, harassment, etc -- report the post and we'll take a look.
  • Download APICodes CPanel script

    Download APICodes CPanel script
    H Offline

    hauntingfox

    New member
    Member
    Oct 5, 2020
    3
    33
    13
    Venezuela
    Hi guys, I found this script on the Internet, that I want to share here with you:

    apicodes-cpanel-poster.png

    Original buy link:
    Please, Log in or Register to view URLs content!

    Note: I do not offer any kind of technical support, please try it at your own risk if you consider yourself adept at this kind of things.

    Requirements:


    Hosting which can be either cPanel hosting or shared hosting or even a dedicated server.
    Please, Log in or Register to view URLs content!

    A dedicated server OR a VPS with at least 2GB or RAM and a decent CPU. running Ubuntu 18.08
    Please, Log in or Register to view URLs content!

    A Cloudflare account, which is free.
    Please, Log in or Register to view URLs content!


    Installation:


    Part A (Setting up Cloudflare)

    1. Create an account at
    Please, Log in or Register to view URLs content!
    .
    2. Change your name servers for your domain.
    3. When domain is set up, enable force https and change ssl to flexible.
    4. Set the following DNS settings.

    TypeNameContentTTL
    CNAMEwww@Auto
    A@Hosting IP addressAuto
    AproxyDedicated / VPS IP addressAuto
    Asv1Dedicated / VPS IP addressAuto
    Asv2Dedicated / VPS IP addressAuto
    Asv3Dedicated / VPS IP addressAuto
    Asv4Dedicated / VPS IP addressAuto
    Asv5Dedicated / VPS IP addressAuto
    Asv6Dedicated / VPS IP addressAuto
    Part B (Hosting the script)

    1. Download the script and then extract to your desktop.
    2. Log into your hosting as you would usually to access file explorer on hosting.
    3. Copy the contents on "/new/source_cpanel" onto your server.
    4. Go to your URL and it show display the script.

    Disclaimer: This will run without the load balancer or proxy HOWEVER if API Codes closes their proxy the script will no longer work so it's best you create your own.

    Part C (Creating the Load Balancer and Proxy)

    1. Log into your VPS or Dedicated server using a SSH like Putty or Termius.
    2. Run the following commands.:

    Code:
    CD /root/



    apt-get install unzip -y

    apt-get install nano -y

    unzip apicodes-gdriveplayer.zip

    chmod 0777 setup.sh

    setup.sh
    3. Once the script has finished run the following command:

    Code:
    nano /root/LoadBalancer/models/CacheManager.js
    change line 46 to the following:

    Code:
    CacheManager.KEY_ENCRYPT = 'apicodesdotcom'
    The press CTRL + X followed by Y to save the file.

    4. Once you've done the above run the following command:

    Code:
    nano /root/LoadBalancer/configs/servers.js
    change line 4 to the following:

    Code:
    exports.NumberNode = 6; //The number of nodes you want to play
    change line 6 to the following:

    Code:
    exports.DomainNode = [' INSERT YOUR OWN DOMAIN WITH NOT HTTPS OR FOLLOWING / ']; //Your primary domain
    The press CTRL + X followed by Y to save the file.

    5. Now run the next command:


    Code:
    nano /root/ProxyStream/models/CacheManager.js
    change line 49 to the following:

    Code:
    CacheManager.KEY_ENCRYPT = 'apicodesdotcom';
    Then press CTRL + X followed by Y to save the file.

    6. Final edits, run the following commands:

    Code:
    nano /root/ProxyStream/configs/servers.js
    change line 3 to the following:

    Code:
    exports.ALLOW_DOMAIN = []; //Domain you want to play.
    7. Setting up NGINX with the proxy and load balancer.

    Input the following command:

    Code:
    nano /etc/ngnix/ngnix.conf
    The following section between lines 57 and 63 will be changes to be careful.

    line 61 and 62 change to

    Code:
    #include /etc/nginx/conf.d/*.conf;
    #include /etc/nginx/sites-enabled/*;
    now on line 60 enter the following:

    Code:
    upstream LoadBalancer {
    server 127.0.0.1:6666;
    }
    upstream ProxyStream {
    server 127.0.0.1:6868;
    }

    server {
    listen 80;
    server_name proxy.yourdomain.com;

    location / {
    proxy_pass http://LoadBalancer;
    proxy_http_version 1.1;
    proxy_send_timeout 600;
    proxy_read_timeout 600;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }

    server {
    listen 80;
    server_name sv1.yourdomain.com;

    location / {
    proxy_pass http://ProxyStream;
    proxy_http_version 1.1;
    proxy_send_timeout 600;
    proxy_read_timeout 600;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }
    change line 70 to the following:

    Code:
    server_name proxy. INSERT YOUR DOMAIN WITH NO TRAILING /;
    change line 86 to the following:

    Code:
    server_name sv1. INSERT YOUR DOMAIN WITH NO TRAILING /;
    and that's it Proxy and Load Balancer are now sorted, you just need to run the following commands to reboot NGINX and Start them.

    Code:
    service nginx restart

    pm2 restart all
    That's all done now :) just need to edit a few files on your hosting to use your new load balancer and proxy.

    Part D (Linking your Dedicated with your hosting)

    1. Go to your hosting file manager again, and edit the config.php file and edit line 5 with the following:

    Code:
    $proxyDomain = '
    Please, Log in or Register to view URLs content!
    . INSERT YOUR DOMAIN NAME WITHOUT THE TRAILING / ';
    And viola done!

    Spoiler: Edits

    You may notice that you need domain.com/?login=admin for this script to work. You can remove lines 10 and 502 in index.php to make it public and work without the login.

    OR

    You can change the login name to whatever you like by editing line 8 in config.php to change the "password"

    If you want to add pop ads or a watermark in the player then edit embed.php and add the advertisement code there.

    Watermark code:

    Code:
    <a href="#" style="position:absolute;top:15px;left:15px;"><img src="IMAGE URL"></a>
    I don't know how to ad VAST apologies if someone can put it in the comments I'll add it here.


    Troubleshooting

    Black screen on player is usually a problem when you've not set up SSL correctly. Go back through instructions and check.

    Silence is golden is usually associated with you forgetting to add ?login=admin look at the edits section to change that requirement.


    Showing two // on the embed link, remove the / from the lines 186 and 187 in the index.php file



    All the credits to:
    Titan
     
    Last edited by a moderator:
    ian Offline

    ian

    Administrator
    Super Moderator
    Trusted Member
    +Lifetime VIP
    Member
    Apr 4, 2020
    2,575
    13,195
    153
    UK
    Hello my friend i have edited you post and hide your link please next time hide your links and take 5 mins of your time and read forum rules

    Thank you
     
    Unown.Ghoul Offline

    Unown.Ghoul

    New member
    Member
    Aug 28, 2021
    5
    1
    3
    Gujrat
    Yw boyi thnku for sharing
     

    Create an account or login to comment

    You must be a member in order to leave a comment

    Create account

    Create an account on our community. It's easy!

    Log in

    Already have an account? Log in here.

    Top Posters of the Month

    Online statistics

    Members online
    86
    Guests online
    483
    Total visitors
    569
    18,332Threads
    64,159Messages
    62,982Members
    PAWA9NLatest member
    Top