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

change nginx-config for subdir to resolve /ocm-provider properly #1280

Merged
merged 3 commits into from
Mar 4, 2019
Merged

change nginx-config for subdir to resolve /ocm-provider properly #1280

merged 3 commits into from
Mar 4, 2019

Conversation

BernieO
Copy link
Contributor

@BernieO BernieO commented Mar 1, 2019

After upgrading to 15.0.5 this is shown in the Admin-panel:

Your web server is not properly set up to resolve “/ocm-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.

I think for runnning nextcloud in a subdirectory of webroot, this redirect has to be added to the configuration

Also see here: https://help.nextcloud.com/t/your-web-server-is-not-properly-set-up-to-resolve-ocm-provider/48530
And here: nextcloud/server#14445

signed-off by bernieo.github@gmx.de

After upgrading to 15.0.5 this is shown in the Admin-panel:
```
Your web server is not properly set up to resolve “/ocm-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.
```
I think for runnning nextcloud in a subdirectory of webroot, this redirect has to be added to the configuration
signed-off by bernieo.github@gmx.de
@BernieO
Copy link
Contributor Author

BernieO commented Mar 1, 2019

Sorry, I forgot to add my name for the signed-off thingie. I am still new to this, please forgive me:
Signed-off-by Bernhard Ostertag bernieo.github@gmx.de

Copy link
Contributor Author

@BernieO BernieO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After having had a think about it, a internal rewrite is probably a better solution than a 301 redirect to everything under /oc(s|m)-provider. So I would suggest changing the three lines to:

location ~ ^\/(?:ocm-provider|ocs-provider).* {
    rewrite ^ /nextcloud$request_uri;
}

Edit 1: I don't know how to change this pull request though - should I open a new one?
Edit 2: As you can see I did manage to change the pull request :-)

signed-off-by Bernhard Ostertag <bernieo.github@gmx.de>

After upgrading to 15.0.5 this is shown in the Admin-panel:
```
Your web server is not properly set up to resolve “/ocm-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.
Your web server is not properly set up to resolve “/ocs-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.
```
I think for runnning nextcloud in a subdirectory of webroot, this rewrite has to be added to the nignx configuration when running nextcloud in a subdirectory of webroot
signed-off-by Bernhard Ostertag <bernio.github@gmx.de>

After upgrading to 15.0.5 this is shown in the Admin-panel:
```
Your web server is not properly set up to resolve “/ocm-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.
Your web server is not properly set up to resolve “/ocs-provider/”. This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in “.htaccess” for Apache or the provided one in the documentation for Nginx at it’s documentation page 1. On Nginx those are typically the lines starting with “location ~” that need an update.
```
I think for runnning nextcloud in a subdirectory of webroot, this rewrite has to be added to the nignx configuration when running nextcloud in a subdirectory of webroot
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense 👍

@MorrisJobke
Copy link
Member

cc @josh4trunks

@MorrisJobke
Copy link
Member

/backport to stable15

Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense

@backportbot-nextcloud
Copy link

backport to stable15 in #1291

@josh4trunks
Copy link
Contributor

@BernieO just wondering why a rewrite is preferred over a 301?

Just to nitpick, regarding the current code, there is no need to have the at the end of the location, that is assumed to be there. I suggest a slight modification...

location ~ ^\/(?:ocm-provider|ocs-provider) {

@MorrisJobke
Copy link
Member

@BernieO just wondering why a rewrite is preferred over a 301?

Just to nitpick, regarding the current code, there is no need to have the at the end of the location, that is assumed to be there. I suggest a slight modification...

Thanks - updated in #1292

@BernieO
Copy link
Contributor Author

BernieO commented Mar 4, 2019

Find my answer here: #1292

@MorrisJobke
Copy link
Member

Hi everyone in here - it turns out that the setup check here is wrong. Both ocm-provider and ocs-provider don’t need to be routed from the root of the domain. We will fix the setup check and documentation accordingly.

@MorrisJobke
Copy link
Member

nextcloud/server#14790

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

Successfully merging this pull request may close these issues.

4 participants