Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cant install the encoder #502

Open
racazahassem09191990 opened this issue Mar 31, 2023 · 18 comments
Open

I cant install the encoder #502

racazahassem09191990 opened this issue Mar 31, 2023 · 18 comments

Comments

@racazahassem09191990
Copy link

I cant install the encoder if the core script are configured for the server running nginx, php8.1 and mariadb.

Please add this update.

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

@DanielnetoDotCom I tried to install it and see what could be his issue and it seems there is a bug and it is a CORS issue
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mytestdomain.test//login. (Reason: Multiple CORS header ‘Access-Control-Allow-Origin’ not allowed). there is somewhere multiple CORS entries that is causing this issue hope this info is useful to you to handle this issue

@racazahassem09191990
Copy link
Author

I fixed it. i deployed core script running apache after that i install the encoder pointed in my core script running apache. after that i add my main core running nginx and i edit as a admin in streamer in encoder section.

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

found the problem it is in the streamers .htaccess ....
take this whole section out....

BEGIN Caching

Header set Access-Control-Allow-Origin: * Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=2592000, public" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=604800, public" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=216000, private" Header set Cache-Control "max-age=216000, public, must-revalidate" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=1, private, must-revalidate" # END Caching

save it and all cors problems are solved
no longer cors errors in the console and all works fine
even with php-fpm and even with ispconfig 3 installed (control panel)

@racazahassem09191990
Copy link
Author

found the problem it is in the streamers .htaccess .... take this whole section out....

BEGIN Caching

Header set Access-Control-Allow-Origin: * Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=2592000, public" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=604800, public" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=216000, private" Header set Cache-Control "max-age=216000, public, must-revalidate" Header set Access-Control-Allow-Origin: * Header set Cache-Control "max-age=1, private, must-revalidate" # END Caching
save it and all cors problems are solved no longer cors errors in the console and all works fine even with php-fpm and even with ispconfig 3 installed (control panel)

where in .htaccess in core? do you have full .htaccess? please.

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

`Options -Indexes

RewriteEngine on
RedirectMatch 404 /\.git
# Deny access to log files
RewriteRule ^.*\.log$ - [F,L,NC]
RewriteRule    ^(.*)enc_watermarked.key$ view/watermarked.key.php?path=$1    [QSA]

#RedirectMatch 403 ^/folder/.+\.(png|gif|js)$

RewriteRule    ^index.php$ view/index.php    [NC,L]
#RewriteRule    ^$ view/    [NC,L]
RewriteRule    ^isAdmin$ view/isAdmin.php    [NC,L]
RewriteRule    ^watermark$ view/watermark.php    [NC,L]
RewriteRule    ^videosListToLive view/videosListToLive.php    [NC,L]
RewriteRule    ^removeStreamer$ view/removeStreamer.php    [NC,L]
RewriteRule    ^priority$ view/priority.php    [NC,L]
RewriteRule    ^status$ view/status.php    [NC,L]
RewriteRule    ^serverStatus$ view/status.php?serverStatus=1    [NC,L]
RewriteRule    ^upload$ view/upload.php    [NC,L]
RewriteRule    ^listFiles.json$ view/listFiles.json.php    [NC,L]
RewriteRule    ^deleteQueue$ view/deleteQueue.php    [NC,L]
RewriteRule    ^saveConfig$ view/saveConfig.php    [NC,L]
RewriteRule    ^youtubeDl.json$ view/youtubeDl.json.php    [NC,L]
RewriteRule    ^send.json$ view/send.json.php    [NC,L]
RewriteRule    ^streamers.json$ view/streamers.json.php    [NC,L]
RewriteRule    ^queue.json$ view/queue.json.php    [NC,L]
RewriteRule    ^queue$ view/queue.php    [NC,L]
RewriteRule    ^login$ objects/login.json.php    [NC,L]
RewriteRule    ^logoff$ objects/logoff.json.php    [NC,L]
RewriteRule    ^getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$ objects/getImage.php?base64Url=$1&format=$2    [NC,L]
RewriteRule    ^getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3,4})/([0-9.]+)$ objects/getImageMP4.php?base64Url=$1&format=$2&time=$3    [NC,L]
RewriteRule    ^getSpiritsFromVideo/([A-Za-z0-9%=/]+)/([0-9]+)/([0-9]+)/([0-9:]+)? objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3&duration=$4    [NC,L]
RewriteRule    ^getLinkInfo/([A-Za-z0-9=/]+)$ objects/getLinkInfo.json.php?base64Url=$1    [NC,L]
Order Allow,Deny Deny from all `

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

htaccess.txt
hope this shows better

@DanielnetoDotCom
Copy link
Member

Sorry I am not getting the point here,

could you make the cors work in a cross-site domain?

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

Sorry I am not getting the point here,

could you make the cors work in a cross-site domain?

The multiple cors problem is because of the .htaccess entries once removed there is no longer a cross domain problem and all will install without problems i have already changed the htaccess file for the streamer as that is where the problems are

@racazahassem09191990
Copy link
Author

How to bypass error page for encoder script?

Error. Oops you've encountered an error
It appears that either something went wrong or the mod rewrite configration is not correct.
We need to allow Apache to read .htaccess files located under the /var/www/html/upload directory. You can do this by editing the Apache configuration file:

Find the section <directory /var/www/html> and change AllowOverride None to AllowOverride All

sudo nano /etc/apache2/apache2.conf
After editing the above file your code should be like this:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

In order to use mod_rewrite you can type the following command in the terminal:

sudo a2enmod rewrite
Restart apache2 after

sudo /etc/init.d/apache2 restart
or

sudo service apache2 restart

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

in ssh or commandline copy and paste these 2 commands
sudo a2enmod rewrite
service apache2 restart

@racazahassem09191990
Copy link
Author

racazahassem09191990 commented Apr 3, 2023

in ssh or commandline copy and paste these 2 commands sudo a2enmod rewrite service apache2 restart

Im using nginx

i install my encoder script in sub folder for my core script.

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

in ssh or commandline copy and paste these 2 commands sudo a2enmod rewrite service apache2 restart

Im using nginx

Nginx does not use rewrite recommended is apache
nginx use for rtmp is recommended

@racazahassem09191990
Copy link
Author

in ssh or commandline copy and paste these 2 commands sudo a2enmod rewrite service apache2 restart

Im using nginx

Nginx does not use rewrite recommended is apache nginx use for rtmp is recommended

All media in my core script are HLS format. apache are not good for serving HLS i think.

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

nginx configuration

location ~ 404 {
rewrite ^(.*)$ /.git redirect;
}

location ~ ^/.*.log$ {
return 403;
}

location / {
rewrite ^/(.*)enc_watermarked.key$ /view/watermarked.key.php?path=$1;
rewrite ^/getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$" /objects/getImage.php?base64Url=$1&format=$2 break;
rewrite ^/getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3,4})/([0-9.]+)$" /objects/getImageMP4.php?base64Url=$1&format=$2&time=$3 break;
}

location = /index.php {
rewrite ^(.*)$ /view/index.php break;
}

location = /isAdmin {
rewrite ^(.*)$ /view/isAdmin.php break;
}

location = /watermark {
rewrite ^(.*)$ /view/watermark.php break;
}

location /videosListToLiv {
rewrite ^/videosListToLive /view/videosListToLive.php break;
}

location = /removeStreamer {
rewrite ^(.*)$ /view/removeStreamer.php break;
}

location = /priority {
rewrite ^(.*)$ /view/priority.php break;
}

location = /status {
rewrite ^(.*)$ /view/status.php break;
}

location = /serverStatus {
rewrite ^(.*)$ /view/status.php?serverStatus=1 break;
}

location = /upload {
rewrite ^(.*)$ /view/upload.php break;
}

location = /listFiles.json {
rewrite ^(.*)$ /view/listFiles.json.php break;
}

location = /deleteQueue {
rewrite ^(.*)$ /view/deleteQueue.php break;
}

location = /saveConfig {
rewrite ^(.*)$ /view/saveConfig.php break;
}

location = /youtubeDl.json {
rewrite ^(.*)$ /view/youtubeDl.json.php break;
}

location = /send.json {
rewrite ^(.*)$ /view/send.json.php break;
}

location = /streamers.json {
rewrite ^(.*)$ /view/streamers.json.php break;
}

location = /queue.json {
rewrite ^(.*)$ /view/queue.json.php break;
}

location = /queue {
rewrite ^(.*)$ /view/queue.php break;
}

location = /login {
rewrite ^(.*)$ /objects/login.json.php break;
}

location = /logoff {
rewrite ^(.*)$ /objects/logoff.json.php break;
}

location /getSpiritsFromVideo {
rewrite ^/getSpiritsFromVideo/([A-Za-z0-9%=/]+)/([0-9]+)/([0-9]+)/([0-9:]+)? /objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3&duration=$4 break;
}

location /getLinkInfo {
rewrite ^/getLinkInfo/([A-Za-z0-9=/]+)$ /objects/getLinkInfo.json.php?base64Url=$1 break;
}

location /avideo.log {
deny all;
}

@racazahassem09191990
Copy link
Author

My encoder script location are here /var/www/html/encoder . so where location block i add that directive?

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

My encoder script location are here /var/www/html/encoder . so where location block i add that directive?

no leave as is and that is for the streamer not the encoder

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

nginx configuration encoder

autoindex off;

location ~ 404 {
rewrite ^(.*)$ /.git redirect;
}

location ~ ^/.*.log$ {
return 403;
}

autoindex off;

location / {
rewrite ^/(.*)enc_watermarked.key$ /view/watermarked.key.php?path=$1;
rewrite "^/getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$" /objects/getImage.php?base64Url=$1&format=$2 break;
rewrite "^/getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3,4})/([0-9.]+)$" /objects/getImageMP4.php?base64Url=$1&format=$2&time=$3 break;
}

location = /index.php {
rewrite ^(.*)$ /view/index.php break;
}

location = /isAdmin {
rewrite ^(.*)$ /view/isAdmin.php break;
}

location = /watermark {
rewrite ^(.*)$ /view/watermark.php break;
}

location /videosListToLiv {
rewrite ^/videosListToLive /view/videosListToLive.php break;
}

location = /removeStreamer {
rewrite ^(.*)$ /view/removeStreamer.php break;
}

location = /priority {
rewrite ^(.*)$ /view/priority.php break;
}

location = /status {
rewrite ^(.*)$ /view/status.php break;
}

location = /serverStatus {
rewrite ^(.*)$ /view/status.php?serverStatus=1 break;
}

location = /upload {
rewrite ^(.*)$ /view/upload.php break;
}

location = /listFiles.json {
rewrite ^(.*)$ /view/listFiles.json.php break;
}

location = /deleteQueue {
rewrite ^(.*)$ /view/deleteQueue.php break;
}

location = /saveConfig {
rewrite ^(.*)$ /view/saveConfig.php break;
}

location = /youtubeDl.json {
rewrite ^(.*)$ /view/youtubeDl.json.php break;
}

location = /send.json {
rewrite ^(.*)$ /view/send.json.php break;
}

location = /streamers.json {
rewrite ^(.*)$ /view/streamers.json.php break;
}

location = /queue.json {
rewrite ^(.*)$ /view/queue.json.php break;
}

location = /queue {
rewrite ^(.*)$ /view/queue.php break;
}

location = /login {
rewrite ^(.*)$ /objects/login.json.php break;
}

location = /logoff {
rewrite ^(.*)$ /objects/logoff.json.php break;
}

location /getSpiritsFromVideo {
rewrite ^/getSpiritsFromVideo/([A-Za-z0-9%=/]+)/([0-9]+)/([0-9]+)/([0-9:]+)? /objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3&duration=$4 break;
}

location /getLinkInfo {
rewrite ^/getLinkInfo/([A-Za-z0-9=/]+)$ /objects/getLinkInfo.json.php?base64Url=$1 break;
}

location /avideo.log {
deny all;
}

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

if that does not work add this to the location block. /var/www/html/encoder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants