Skip to content

Instantly share code, notes, and snippets.

@ustoopia
Created March 20, 2023 22:25
Show Gist options
  • Save ustoopia/65fc72da890cbb5a4d0108a57187118a to your computer and use it in GitHub Desktop.
Save ustoopia/65fc72da890cbb5a4d0108a57187118a to your computer and use it in GitHub Desktop.
Nginx config for YouPHPTube encoder
server {
listen 80;
server_name <URL> <www.URL>;
root /var/www/encoder;
index index.php;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
client_max_body_size 2G;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log combined;
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
fastcgi_intercept_errors on;
fastcgi_read_timeout 120;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_param front_controller_active true;
fastcgi_request_buffering off;
}
location = /index.php {
rewrite ^(.*)$ /view/index.php last;
}
location = /isAdmin {
rewrite ^(.*)$ /view/isAdmin.php last;
}
location = /removeStreamer {
rewrite ^(.*)$ /view/removeStreamer.php last;
}
location = /priority {
rewrite ^(.*)$ /view/priority.php last;
}
location = /status {
rewrite ^(.*)$ /view/status.php last;
}
location = /serverStatus {
rewrite ^(.*)$ /view/status.php?serverStatus=1 last;
}
location = /upload {
rewrite ^(.*)$ /view/upload.php last;
}
location = /listFiles.json {
rewrite ^(.*)$ /view/listFiles.json.php last;
}
location = /deleteQueue {
rewrite ^(.*)$ /view/deleteQueue.php last;
}
location = /saveConfig {
rewrite ^(.*)$ /view/saveConfig.php last;
}
location = /youtubeDl.json {
rewrite ^(.*)$ /view/youtubeDl.json.php last;
}
location = /send.json {
rewrite ^(.*)$ /view/send.json.php last;
}
location = /streamers.json {
rewrite ^(.*)$ /view/streamers.json.php last;
}
location = /queue.json {
rewrite ^(.*)$ /view/queue.json.php last;
}
location = /queue {
rewrite ^(.*)$ /view/queue.php last;
}
location = /login {
rewrite ^(.*)$ /objects/login.json.php last;
}
location = /logoff {
rewrite ^(.*)$ /objects/logoff.json.php last;
}
location / {
rewrite "^/getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$" /objects/getImage.php?base64Url=$1&format=$2 last;
rewrite "^/getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})/([0-9.]+)$" /objects/getImageMP4.php?base64Url=$1&format=$2&time=$3 last;
}
location /getSpiritsFromVideo {
rewrite ^/getSpiritsFromVideo/([A-Za-z0-9=/]+)/([0-9]+)/([0-9]+)$ /objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3 last;
}
location /getLinkInfo {
rewrite ^/getLinkInfo/([A-Za-z0-9=/]+)$ /objects/getLinkInfo.json.php?base64Url=$1 last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment