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

nginx is not working #335

Closed
mayunbaba2 opened this issue Jan 27, 2018 · 15 comments
Closed

nginx is not working #335

mayunbaba2 opened this issue Jan 27, 2018 · 15 comments

Comments

@mayunbaba2
Copy link

No description provided.

@mayunbaba2
Copy link
Author

must install Apache????

@DanielnetoDotCom
Copy link
Member

@patriclougheed
Copy link

I was able to get the front-end working without Apache using this conf:

server {
listen 80;
server_name YOUR DOMAIN;
root /var/www;
index index.php;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
client_max_body_size 1G;

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 /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 /page {
rewrite ^/page/([0-9]+)/?$ /view/?page=$1 last;
}

location /videoOnly {
rewrite ^/videoOnly/?$ /view/?type=video last;
}

location /audioOnly {
rewrite ^/audioOnly/?$ /view/?type=audio last;
}

location = /download {
rewrite ^(.*)$ /view/downloadExternalVideo.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 = /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-]+)/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;
}

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;
}

location /videoEmbeded {
rewrite ^/videoEmbeded/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?videoName=$1;
}

location /plugin {
rewrite ^/plugin/([A-Za-z0-9-_.]+)/(.*)?$ /plugin/$1/$2 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 = /ads {
rewrite ^(.*)$ /view/managerAds.php last;
}

location = /addNewAd {
rewrite ^(.*)$ /objects/video_adsAddNew.json.php last;
}

location = /ads.json {
rewrite ^(.*)$ /objects/video_ads.json.php last;
}

location = /deleteVideoAd {
rewrite ^(.*)$ /objects/video_adDelete.json.php last;
}

location /adClickLo {
rewrite ^/adClickLog /objects/video_adClickLog.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 = /pluginsAvailable.json {
rewrite ^(.*)$ /objects/pluginsAvailable.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/([0-9]+)/?$ /view/channel.php?user_id=$1 last;
rewrite ^/channel/?$ /view/channel.php last;
}

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 = /reencodeVideo {
rewrite ^(.*)$ /objects/videoReencode.json.php last;
}

location = /rotateVideo {
rewrite ^(.*)$ /objects/videoRotate.json.php last;
}

location = /addViewCountVideo {
rewrite ^(.*)$ /objects/videoAddViewCount.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 = /youPHPTubeQueueEncoder.json {
rewrite ^(.*)$ /objects/youPHPTubeQueueEncoder.json.php last;
}

location = /youPHPTubeEncoder.json {
rewrite ^(.*)$ /objects/youPHPTubeEncoder.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/?$ /update/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 = /youtubeUpload {
rewrite ^(.*)$ /objects/youtubeUpload.json.php last;
}

location = /googleAdView {
rewrite ^(.*)$ /view/googleAdView.php last;
}

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

}

@DanielnetoDotCom
Copy link
Member

This is great thanks

@nightstryke
Copy link

nightstryke commented Mar 2, 2018

@DanielnetoDotCom How would I implement the conf @patriclougheed posted with the stream server nginx.conf?

@nightstryke
Copy link

nightstryke commented Mar 3, 2018

@DanielnetoDotCom Don't be too quick to use the nginx settings. I managed to get it working on my test server, but I'm getting this error. So the nginx.conf settings are not perfect....yet....

error

@DanielnetoDotCom
Copy link
Member

@nightstryke I have never install it on NGINX, but take a look on that: #25

@nightstryke
Copy link

@DanielnetoDotCom yeah i tried the config in #25 It did not work kept giving me an error 502

@DanielnetoDotCom
Copy link
Member

@nightstryke I have never tried to install on NGINX, the only reference I had was users that could install it.

@Amunak
Copy link

Amunak commented Mar 7, 2018

You should really get a real router instead of this monstrosity, that would help with both Apache (in performance) and Nginx (so that you don't need a monstrous site config).

Then it shouldn't be too hard to support nginx as well.

@DanielnetoDotCom
Copy link
Member

Agree with you, I was thinking to change this, I just dont have a chance yet

@Amunak
Copy link

Amunak commented Mar 8, 2018

Really all you really need to do is convert all those rewrite rules into PHP and require the correct files, while writing a single rewrite rule that passes all parameters to that router.

@DanielnetoDotCom
Copy link
Member

I know, but it is not that simple, certainly it will need to change filenames

@hersche
Copy link
Contributor

hersche commented Jun 7, 2018

hello, i am working on implement a php-router.

according to the docs, it would be quite easy for nginx:
https://github.com/skipperbent/simple-php-router#setting-up-nginx

because this needed a lot of editing, proper testing would be nice. at the moment, i know nothing, that does not work, but i am far away from testing everything.

anyone who would like to join testing can find the source here:
https://github.com/DanielnetoDotCom/YouPHPTube/tree/php-router

there is also a live-demo with the new code (on apache!), if you would like to test, but not waste time in install it. just say the username here and you will get admin after i see it..
https://rewrite.codebea.ch/

@hersche
Copy link
Contributor

hersche commented Jun 14, 2018

there's a documentation + the php-router now, so this should be done.

https://github.com/DanielnetoDotCom/YouPHPTube/wiki/Admin-manual

if it's not, feel free to reopen this issue or #691

@hersche hersche closed this as completed Jun 14, 2018
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

6 participants