Skip to content

Conversation

@tenkoma
Copy link
Member

@tenkoma 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 [WIP]Improve url rewrite by nginx Improve url rewrite by nginx Apr 15, 2017
@tenkoma
Copy link
Member Author

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
@markstory
Copy link
Member

Thanks @tenkoma !

markstory added a commit that referenced this pull request Apr 15, 2017
@tenkoma tenkoma deleted the improve-nginx-configuration branch April 16, 2017 00:21
@okinaka okinaka mentioned this pull request Apr 22, 2017
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants