Created
March 20, 2023 22:24
-
-
Save ustoopia/7036bace2a9ef0b09e4d01f3ff8303fc to your computer and use it in GitHub Desktop.
Nginx config for YouPHPTube streamer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name <domain> <www.domain>; | |
root /var/www; | |
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; | |
# Add headers to serve security related headers | |
# Before enabling Strict-Transport-Security headers please read into this topic first. | |
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains"; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Robots-Tag none; | |
add_header X-Download-Options noopen; | |
add_header X-Permitted-Cross-Domain-Policies none; | |
location ~ \.php$ { | |
#fastcgi_pass 127.0.0.1:9000; | |
fastcgi_pass unix:/var/run/php/php7.3-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 / { | |
if ($request_uri ~ "\.(jpg|jpeg|gif|png|ico)$"){ | |
rewrite .*$ /img/image404.php last; | |
} | |
if (!-e $request_filename){ | |
rewrite .*$ /view/error.php last; | |
} | |
rewrite bootstrap-select.js.map$ /view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.js.map$1 last; | |
} | |
location = /index.php { | |
rewrite ^(.*)$ /view/index.php last; | |
} | |
location /bootstrap { | |
rewrite ^/bootstrap/(.+)$ /view/bootstrap/$1 last; | |
} | |
location /js { | |
rewrite ^/js/(.+)$ /view/js/$1 last; | |
} | |
location /css { | |
rewrite ^/css/(.+)$ /view/css/$1 last; | |
} | |
location /img { | |
rewrite ^/img/(.+)$ /view/img/$1 last; | |
} | |
location /videos { | |
rewrite ^/videos/fonts/(.+)$ /view/bootstrap/fonts/$1 last; | |
rewrite ^/videos/(.*)/index.m3u8$ /view/hls.php?videoDirectory=$1 last; | |
rewrite ^/videos/([A-Za-z0-9-_.]+)$ /view/xsendfile.php?file=$1; | |
#rewrite ^/videos/(.*)/index.m3u8.mp4$ /view/hls.php?playHLSasMP4=1&videoDirectory=$1; | |
#rewrite ^/videos/(.*)/index.m3u8.mp4$ /view/hls.php?download=1&videoDirectory=$1 last; | |
} | |
location /page { | |
rewrite ^/page/([0-9]+)/?$ /view/?page=$1; | |
} | |
location /videoOnly { | |
rewrite ^/videoOnly/?$ /view/?type=video last; | |
} | |
location /audioOnly { | |
rewrite ^/audioOnly/?$ /view/?type=audio last; | |
} | |
location = /download { | |
rewrite ^(.*)$ /view/downloadExternalVideo.php last; | |
} | |
location = /info { | |
rewrite ^(.*)$ /view/info.php last; | |
} | |
location = /downloadNow { | |
rewrite ^(.*)$ /objects/downloadVideo.php last; | |
} | |
location = /getDownloadProgress { | |
rewrite ^(.*)$ /objects/downloadVideoProgress.php last; | |
} | |
location = /status { | |
rewrite ^(.*)$ /objects/status.json.php last; | |
} | |
location /menu { | |
rewrite ^/menu/([A-Za-z0-9-_.]+)/? /plugin/TopMenu/seo.php?menuSeoUrlItem=$1 last; | |
} | |
location /admin { | |
rewrite ^/admin/plugin/(.+)$ /plugin/$1 last; | |
} | |
location /trending { | |
rewrite ^/trending/?$ /view/trending.php last; | |
} | |
location = /about { | |
rewrite ^(.*)$ /view/about.php last; | |
} | |
location = /contact { | |
rewrite ^(.*)$ /view/contact.php last; | |
} | |
location = /sendEmail { | |
rewrite ^(.*)$ /objects/sendEmail.json.php last; | |
} | |
location = /captcha { | |
rewrite ^(.*)$ /objects/getCaptcha.php last; | |
} | |
location /monitor { | |
rewrite ^/monitor/(.+)$ /objects/ServerMonitor/$1 last; | |
} | |
location = /videosList { | |
rewrite ^(.*)$ /view/videosList.php last; | |
} | |
location /videosList { | |
rewrite ^/videosList/video/([A-Za-z0-9-_.]+)/page/([0-9]+)/?$ /view/videosList.php?videoName=$1&page=$2; | |
rewrite ^/videosList/cat/([A-Za-z0-9-]+)/video/([A-Za-z0-9-_.]+)/page/([0-9]+)/?$ /view/videosList.php?catName=$1&videoName=$2&page=$3; | |
} | |
location /cat { | |
rewrite ^/cat/([A-Za-z0-9-]+)/?$ /view/?catName=$1 last; | |
rewrite ^/cat/([A-Za-z0-9-]+)/page/([0-9]+)/?$ /view/?catName=$1&page=$2 last; | |
rewrite ^/cat/([A-Za-z0-9-]+)/video/([A-Za-z0-9-_.]+)/?$ /view/?catName=$1&videoName=$2; | |
rewrite ^/cat/([A-Za-z0-9-]+)/video/([A-Za-z0-9-_.]+)/page/([0-9]+)/?$ /view/?catName=$1&videoName=$2&page=$3; | |
rewrite ^/cat/([A-Za-z0-9-_.]+)/videoEmbeded/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?catName=$1&videoName=$2; | |
} | |
location /tag { | |
rewrite ^/tag/([0-9-]+)(.*)?$ /view/?tags_id=$1 last; | |
} | |
location /video { | |
rewrite ^/video/([A-Za-z0-9-_.]+)/?$ /view/?videoName=$1; | |
rewrite ^/video/([A-Za-z0-9-_.]+)/page/([0-9]+)/??$ /view/?videoName=$1&page=$2; | |
rewrite ^/video/([0-9]+)/([A-Za-z0-9-_.]+)/?$ /view/?v=$1; | |
rewrite ^/video/([0-9]+)/([A-Za-z0-9-_.]+)/page/([0-9]+)/??$ /view/?v=$1&page=$3; | |
} | |
location /v { | |
rewrite ^/v/([0-9]+)/?$ /view/?v=$1; | |
rewrite ^/v/([0-9]+)/page/([0-9]+)/??$ /view/?v=$1&page=$2; | |
} | |
location /videoEmbeded { | |
rewrite ^/videoEmbeded/([0-9]+)/? /view/videoEmbeded.php?v=$1; | |
rewrite ^/videoEmbeded/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?videoName=$1; | |
} | |
location /videoEmbed { | |
rewrite ^/videoEmbed/([0-9]+)/? /view/videoEmbeded.php?v=$1; | |
rewrite ^/videoEmbed/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?videoName=$1; | |
rewrite ^/videoEmbed/([0-9]+)/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?v=$1; | |
} | |
location /vEmbed { | |
rewrite ^/vEmbed/([0-9]+)/?$ /view/videoEmbeded.php?v=$1; | |
} | |
location = /pluginsAvailable.json { | |
rewrite ^(.*)$ /objects/pluginsAvailable.json.php last; | |
} | |
location = /upload { | |
rewrite ^(.*)$ /view/mini-upload-form/ last; | |
} | |
location = /fileUpload { | |
rewrite ^(.*)$ /view/mini-upload-form/upload.php last; | |
} | |
location /uploadPoster { | |
rewrite ^/uploadPoster/([0-9]+)/(jpg|gif)$ /objects/uploadPoster.php?video_id=$1&type=$2 last; | |
} | |
location = /user { | |
rewrite ^(.*)$ /view/user.php last; | |
} | |
location = /users { | |
rewrite ^(.*)$ /view/managerUsers.php last; | |
} | |
location = /users.json { | |
rewrite ^(.*)$ /objects/users.json.php last; | |
} | |
location = /updateUser { | |
rewrite ^(.*)$ /objects/userUpdate.json.php last; | |
} | |
location = /savePhoto { | |
rewrite ^(.*)$ /objects/userSavePhoto.php last; | |
} | |
location = /saveBackground { | |
rewrite ^(.*)$ /objects/userSaveBackground.php last; | |
} | |
location = /addNewUser { | |
rewrite ^(.*)$ /objects/userAddNew.json.php last; | |
} | |
location = /deleteUser { | |
rewrite ^(.*)$ /objects/userDelete.json.php last; | |
} | |
location = /recoverPass { | |
rewrite ^(.*)$ /objects/userRecoverPass.php last; | |
} | |
location = /saveRecoverPassword { | |
rewrite ^(.*)$ /objects/userRecoverPassSave.json.php last; | |
} | |
location = /signUp { | |
rewrite ^(.*)$ /view/signUp.php last; | |
} | |
location = /createUser { | |
rewrite ^(.*)$ /objects/userCreate.json.php last; | |
} | |
location = /usersGroups { | |
rewrite ^(.*)$ /view/managerUsersGroups.php last; | |
} | |
location = /usersGroups.json { | |
rewrite ^(.*)$ /objects/usersGroups.json.php last; | |
} | |
location = /addNewUserGroups { | |
rewrite ^(.*)$ /objects/userGroupsAddNew.json.php last; | |
} | |
location = /deleteUserGroups { | |
rewrite ^(.*)$ /objects/userGroupsDelete.json.php last; | |
} | |
location = /categories { | |
rewrite ^(.*)$ /view/managerCategories.php last; | |
} | |
location = /categories.json { | |
rewrite ^(.*)$ /objects/categories.json.php last; | |
} | |
location = /addNewCategory { | |
rewrite ^(.*)$ /objects/categoryAddNew.json.php last; | |
} | |
location = /deleteCategory { | |
rewrite ^(.*)$ /objects/categoryDelete.json.php last; | |
} | |
location = /plugins { | |
rewrite ^(.*)$ /view/managerPlugins.php last; | |
} | |
location = /plugins.json { | |
rewrite ^(.*)$ /objects/plugins.json.php last; | |
} | |
location = /pluginImport.json { | |
rewrite ^(.*)$ /objects/pluginImport.json.php last; | |
} | |
location = /switchPlugin { | |
rewrite ^(.*)$ /objects/pluginSwitch.json.php last; | |
} | |
location = /addDataObjectPlugin.json { | |
rewrite ^(.*)$ /objects/pluginAddDataObject.json.php last; | |
} | |
location = /runDBScriptPlugin.json { | |
rewrite ^(.*)$ /objects/pluginRunDatabaseScript.json.php last; | |
} | |
location = /playLists.json { | |
rewrite ^(.*)$ /objects/playlists.json.php last; | |
} | |
location = /playListsVideos.json { | |
rewrite ^(.*)$ /objects/playlistsVideos.json.php last; | |
} | |
location /playListsFromUser { | |
rewrite ^/playListsFromUser.json/([0-9]+)/?$ /objects/playlistsFromUser.json.php?users_id=$1 last; | |
} | |
location = /addNewPlayList { | |
rewrite ^(.*)$ /objects/playlistAddNew.json.php last; | |
} | |
location = /playListAddVideo.json { | |
rewrite ^(.*)$ /objects/playListAddVideo.json.php last; | |
} | |
location /playlist { | |
rewrite ^/playlist/([0-9]+)/([0-9]+)/?$ /view/?playlist_id=$1&playlist_index=$2 last; | |
rewrite ^/playlist/([0-9]+)/?$ /view/?playlist_id=$1 last; | |
} | |
location /removeVideoFromPlaylist { | |
rewrite ^/removeVideoFromPlaylist/?$ /objects/playlistRemoveVideo.php last; | |
} | |
location /removePlaylist { | |
rewrite ^/removePlaylist/?$ /objects/playlistRemove.php last; | |
} | |
location /renamePlaylist { | |
rewrite ^/renamePlaylist/?$ /objects/playlistRename.php last; | |
} | |
location /sortPlaylist { | |
rewrite ^/sortPlaylist/?$ /objects/playlistSort.php last; | |
} | |
location /channel { | |
rewrite ^/channel/([^/]+)/feed/?$ /feed/index.php?channelName=$1; | |
rewrite ^/channel/([^/]+) /view/channel.php?channelName=$1; | |
rewrite ^/channel/?$ /view/channel.php; | |
rewrite ^/channel/([^/]+)/roku.json$ /feed/index.php?channelName=$1&roku=1; | |
} | |
location /channels { | |
rewrite ^/channels/?$ /view/channels.php last; | |
} | |
location = /programs.json { | |
rewrite ^(.*)$ /objects/playlists.json.php; | |
} | |
location /program { | |
rewrite ^/program/([0-9]+)/([0-9]+)(/.*)?$ /view/?playlist_id=$1&playlist_index=$2; | |
rewrite ^/program/([0-9]+)(/.*)?$ /view/?playlist_id=$1; | |
} | |
location /viewProgram { | |
rewrite ^/viewProgram/([0-9]+).*?$ /view/channelProgram.php?program_id=$1; | |
} | |
location = /orphanFiles { | |
rewrite ^(.*)$ /view/orphanFiles.php last; | |
} | |
location = /mvideos { | |
rewrite ^(.*)$ /view/managerVideos.php last; | |
} | |
location = /videos.json { | |
rewrite ^(.*)$ /objects/videos.json.php last; | |
} | |
location = /videosAndroid.json { | |
rewrite ^(.*)$ /objects/videosAndroid.json.php last; | |
} | |
location = /videoAndroid.json { | |
rewrite ^(.*)$ /objects/videoAndroid.json.php last; | |
} | |
location = /deleteVideo { | |
rewrite ^(.*)$ /objects/videoDelete.json.php last; | |
} | |
location = /addNewVideo { | |
rewrite ^(.*)$ /objects/videoAddNew.json.php last; | |
} | |
location = /refreshVideo { | |
rewrite ^(.*)$ /objects/videoRefresh.json.php last; | |
} | |
location = /setStatusVideo { | |
rewrite ^(.*)$ /objects/videoStatus.json.php last; | |
} | |
location = /setCategoryVideo { | |
rewrite ^(.*)$ /objects/videoCategory.json.php last; | |
} | |
location = /rotateVideo { | |
rewrite ^(.*)$ /objects/videoRotate.json.php last; | |
} | |
location = /subscribes { | |
rewrite ^(.*)$ /view/managerSubscribes.php last; | |
} | |
location = /subscribes.json { | |
rewrite ^(.*)$ /objects/subscribes.json.php last; | |
} | |
location = /subscribe.json { | |
rewrite ^(.*)$ /objects/subscribe.json.php last; | |
} | |
location = /notifySubscribers.json { | |
rewrite ^(.*)$ /objects/notifySubscribers.json.php last; | |
} | |
location = /aVideoQueueEncoder.json { | |
rewrite ^(.*)$ /objects/aVideoQueueEncoder.json.php last; | |
} | |
location = /aVideoEncoder.json { | |
rewrite ^(.*)$ /objects/aVideoEncoder.json.php last; | |
} | |
location = /comments { | |
rewrite ^(.*)$ /view/managerComments.php last; | |
} | |
location = /saveComment { | |
rewrite ^(.*)$ /objects/commentAddNew.json.php last; | |
} | |
location /comments { | |
rewrite ^/comments.json/([0-9]+)$ /objects/comments.json.php?video_id=$1 last; | |
} | |
location = /login { | |
rewrite ^(.*)$ /objects/login.json.php last; | |
} | |
location = /logoff { | |
rewrite ^(.*)$ /objects/logoff.php last; | |
} | |
location = /like { | |
rewrite ^(.*)$ /objects/like.json.php?like=1; | |
} | |
location = /dislike { | |
rewrite ^(.*)$ /objects/like.json.php?like=-1; | |
} | |
location /update { | |
rewrite ^/update/?$ /view/update.php last; | |
} | |
location = /siteConfigurations { | |
rewrite ^(.*)$ /view/configurations.php last; | |
} | |
location = /updateConfig { | |
rewrite ^(.*)$ /objects/configurationUpdate.json.php last; | |
} | |
location = /charts { | |
rewrite ^(.*)$ /view/charts.php last; | |
} | |
location = /help { | |
rewrite ^(.*)$ /view/help.php last; | |
} | |
location = /youtubeUpload { | |
rewrite ^(.*)$ /objects/youtubeUpload.json.php last; | |
} | |
location = /googleAdView { | |
rewrite ^(.*)$ /view/googleAdView.php last; | |
} | |
location = /notifications.json { | |
rewrite ^(.*)$ /objects/notifications.json.php last; | |
} | |
location = /sitemap.xml { | |
rewrite ^(.*)$ /view/sitemap.xml.php last; | |
} | |
location = /robots.txt { | |
rewrite ^(.*)$ /view/robots.txt.php last; | |
} | |
location /vast { | |
rewrite ^/vast.xml/?([0-9]+)?$ /plugin/AD_Server/VAST.php?campaign_has_videos_id=$1 last; | |
} | |
location /routes.php { | |
deny all; | |
} | |
location /PayPal.log { | |
deny all; | |
} | |
location /avideo.log { | |
deny all; | |
} | |
location /avideo.js.log { | |
deny all; | |
} | |
location /meet { | |
rewrite ^/meet/([0-9]+)/(.+)$ /plugin/Meet/iframe.php?meet_schedule_id=$1&roomName=$2 last; | |
rewrite ^/meet/([0-9]+)$ /plugin/Meet/iframe.php?meet_schedule_id=$1 last; | |
} | |
location /live { | |
rewrite ^/live/([0-9]+)/(.+)$ /plugin/Live/?live_servers_id=$1&c=$2 last; | |
} | |
location /favorite { | |
rewrite ^/favorite/?$ /view/?playlist_id=favorite; | |
} | |
location /watch { | |
rewrite ^/watch-later/?$ /view/?playlist_id=watch-later; | |
} | |
location = /aVideoEncoderChunk.json { | |
rewrite ^(.*)$ /objects/aVideoEncoderChunk.json.php last; | |
} | |
location /user { | |
rewrite ^/user/([0-9]+)/foto.png$ /view/userGetPhoto.php?users_id=$1; | |
} | |
location = /roku.json { | |
rewrite ^(.*)$ /feed/index.php?roku=1; | |
} | |
location /mrss { | |
rewrite ^/mrss/?$ /feed/index.php?mrss=1; | |
} | |
location /liveLink { | |
rewrite ^/liveLink/([0-9]+).*$ /plugin/LiveLinks/view/Live.php?link=$1 last; | |
} | |
location /liveLinkEmbed { | |
rewrite ^/liveLinkEmbed/([0-9]+).*$ /plugin/LiveLinks/view/Live.php?link=$1&embed=1 last; | |
} | |
location = /epg.xml { | |
rewrite ^(.*)$ /plugin/PlayLists/epg.xml.php last; | |
} | |
location = /epg.json { | |
rewrite ^(.*)$ /plugin/PlayLists/epg.json.php last; | |
} | |
location = /epg.html { | |
rewrite ^(.*)$ /plugin/PlayLists/epg.html.php last; | |
} | |
location = /epg { | |
rewrite ^(.*)$ /plugin/PlayLists/epg.php last; | |
} | |
location = /tv { | |
rewrite ^(.*)$ /plugin/PlayLists/tv.php last; | |
} | |
location = /iptv { | |
rewrite ^(.*)$ /plugin/PlayLists/iptv.php last; | |
} | |
location /iptv { | |
rewrite ^/iptv/([^/]+)/?$ /plugin/PlayLists/iptv.php?channelName=$1 last; | |
} | |
location /oembed { | |
rewrite ^/oembed/?(.+)$ /view/oembed.php$1 last; | |
} | |
location /playLink { | |
rewrite ^/playLink/?$ /view/modePlayLink.php last; | |
} | |
location = /listCategories { | |
rewrite ^(.*)$ /view/listCategories.php last; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment