-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
oc-1875 : running OwnCloud on an alias (or not) with Nginx #22
Conversation
Hi Thomas. Thanks for the patch. unfortunately we are in feature freeze and 4.5 is only a few days away. We will test and merge this after 4.5 |
OK, not a problem, it gives me more time for further testing and and explore various use cases, for exemple I will try OC use on a sub directory, this is a case where $SERVERROOT != $DOCUMENTROOT :) |
apache doesn't fill $_SERVER["DOCUMENT_URI"], so this can't be used as is. |
I made some tests and you're right, this variable is empty ... :/ Also, tests show me another problem with apache : I'm working to find another way to guess WEBROOT (there is other variables). |
OK, if nginx mimic apache (fastcgi_param SCRIPT_NAME /alias$fastcgi_script_name;) $PATH_ARRAY=explode('/', $_SERVER['SCRIPT_NAME']); This works for both Apache and Nginx, for three use case : if we do not trust $_SERVER['SCRIPT_NAME'], we can guess it from $_SERVER['REQUEST_URI'] without "?$_SERVER['QUERY_STRING']" or from $_SERVER['REQUEST_URI'] without $_SERVER['PATH_INFO']. with /var/www/script.php and /var/www/subdir/script.php containing with apache (localhost) and nginx (localhost:8080) configured with alias /alias and without alias, I get this : GET http://localhost/script.php [EDIT: HUM, it does'nt works for scripts like /settings/personnal.php, I continue to dig…] |
With this commit, it should works on both Apache and Nginx (if Nginx mimics Apache naming) for these installations :
WEBROOT and SUBURI are calculated without DocumentUri, from OC::SERVERROOT, $_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_NAME'], $_SERVER['SCRIPT_FILENAME'] and $_SERVER['PATH_INFO'] Note : to be more agnostic, we can calculate $_SERVER['SCRIPT_NAME'] from $_SERVER['REQUEST_URI'] without "?$_SERVER['QUERY_STRING']" or from $_SERVER['REQUEST_URI'] without $_SERVER['PATH_INFO'] |
Can you please rebase? Automatic merge not possible at the moment. - THX Who wants to take care of this? I have no idea about Nginx. |
I'll do some more tests, it is necessary that I check another case that I have not yet tested
This is especially a problem with fastcgi or anything that is not Apache mod_php :D Also, I have a question: do you think it is a good idea to set webroot in config.php: the idea is to use this variable if the administrator has set it, and calculate if it is not filled (with overload due to comparison of strings). Also, this would allow advanced administrators to have OC working with exotic sofware when calculation of this variable will not work. |
@illwieckz please rebase - I'll try to find reviewers for this - THX |
I've found a bug with this code : it doesn't works when ownCloud is accessed via an alias AND is not installed, the installation page never comes because redirecting indefinitely :
So, I don't know why. The bug is perhaps elsewhere in ownCloud code, my code only handle URL writing, not redirection. |
@DeepDiver1975 : how I rebase on github ? |
@illwieckz Can you make this PR uptodate by following @DeepDiver1975 s instructions or can you resubmit? Thanks for the link btw @DeepDiver1975 ;) |
@DeepDiver1975 : thanks your page was more relevant than this one : http://learn.github.com/p/rebasing.html But the merge was too complicated so I thought it might be easier to fork the repo again and to put my changes into a single commit to resubmit... bad idea, GitHub replied "404" when I try to fork again. :/ |
Hi, this is the code that I described in my recent bug report:
http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-1875
Purpose is to use Owncloud as an alias with Nginx. The code calculate OC::$SUBURI and OC::$WEBROOT using $_SERVER["SCRIPT_NAME"], $_SERVER["DOCUMENT_URI"] and $_SERVER["PATH_INFO"].
I was invited to do a "merge request":
http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-1875#comment_1_1877_9612
I hope to do it right!