Improve url rewrite by nginx #4903

Merged
merged 2 commits into from Apr 15, 2017

Conversation

Projects
None yet
3 participants
@tenkoma
Member

tenkoma commented Apr 14, 2017

I made the Url rewrite setting of nginx simple.

The following trouble was reported on Slack Japanese channel. (Reported by @shinderuman )

Installation

rewrite 301 http://www.example.com$request_uri permanent;

In this setting, redirects if '301' is included in the URL such as 'http: //my.domain/foo/edit/10301'

But trying to fix it will cause a redirect all.
Initially, in this alternate configuration, the server directive is put together into one, but in the linked nginx document, it is said that it is the right way to divide by domain.

I want to improve as follows

  • Lose alternative configuration and make it universal config.
  • Specify configurations directly related to URL rewrite, and exemplify the entire server directive as a supplement.

I tested it in the following environments:

  • Ubuntu 14.04 LTS, nginx 1.4(repos: ubuntu update), PHP7.1(repos: ppa:ondrej/php)
  • Ubuntu 16.04 LTS, nginx 1.10(repos: ubuntu update), PHP7.0(repos: ubuntu update)
  • CentOS 6.8, nginx 1.12(repos: nginx official), PHP7.1 or 5.6(repos: remi)
  • CentOS 7.3, nginx 1.12(repos: nginx official), PHP7.1 or 5.6(repos: remi)

In case of Ubuntu, Needs to change fastcgi_pass to socket path so I copied the note from the CakePHP2 Book. Other than that, it works with the same configuration.

@markstory markstory added this to the 3.x milestone Apr 15, 2017

@markstory markstory self-assigned this Apr 15, 2017

@tenkoma tenkoma changed the title from [WIP]Improve url rewrite by nginx to Improve url rewrite by nginx Apr 15, 2017

@tenkoma

This comment has been minimized.

Show comment
Hide comment
@tenkoma

tenkoma Apr 15, 2017

Member

I tested it on Ubuntu and CentOS.
Please review.

Member

tenkoma commented Apr 15, 2017

I tested it on Ubuntu and CentOS.
Please review.

@markstory markstory merged commit c8e4b8d into cakephp:3.0 Apr 15, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@markstory

This comment has been minimized.

Show comment
Hide comment
@markstory

markstory Apr 15, 2017

Member

Thanks @tenkoma !

Member

markstory commented Apr 15, 2017

Thanks @tenkoma !

markstory added a commit that referenced this pull request Apr 15, 2017

@tenkoma tenkoma deleted the tenkoma:improve-nginx-configuration branch Apr 16, 2017

okinaka added a commit to okinaka/docs that referenced this pull request Apr 22, 2017

@okinaka okinaka referenced this pull request Apr 22, 2017

Merged

[ja] sync 3.0 docs. #4919

HavokInspiration added a commit that referenced this pull request Jun 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment