Answers.Body: <p>For me, this didn't have anything to do with rewrites.  I installed WTServer (WinNMP) and a fresh copy of Craft.</p>
  
  <p>I noticed the same 400 response when trying to log in and was seeing this in the body:</p>
  
  <blockquote>
    <p>400 Request Header Or Cookie Too Large</p>
  </blockquote>
  
  <p>After a quick Google, I noticed that the default nginx config that WTServer has these set:</p>
  
  <pre><code>client_header_buffer_size   1k;
  large_client_header_buffers 2 1k;
  </code></pre>
  
  <p>I bumped those up to this:</p>
  
  <pre><code>client_header_buffer_size   8k;
  large_client_header_buffers 8 16k;
  </code></pre>
  
  <p>Restarted nginx and everything started working fine.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T15:15:00.420Z
Answers.Text: Boom! Thanks so much Brad. Huge Craft points. You just made me more willing to dive in.
Answers.UserDisplayName: Jim
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-09T22:21:53.220Z
Answers.LastActivityDate: 2019-04-09T22:21:53.220Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>This is my clean wtserver/winnmp nginx conf file for Craft (and pretty much anything else like Laravel etc.).</p>
  
  <pre><code>server {
  
      listen          127.0.0.1:80;
      server_name     icraft.test; # locked
      root            "c:\web\icraft\public"; # locked
  
      allow           127.0.0.1;
      deny            all;
      autoindex       on;
  
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
  
      location ~ \.php$ {
          try_files $uri =404;
          include         nginx.fastcgi.conf;
          include         nginx.redis.conf;
          fastcgi_pass    php_farm;
      }
  
  }
  </code></pre>
  
  <p>Assuming you installed winnmp to <code>c:\web\winnmp</code>, this file would go to <code>c:\web\winnmp\conf\domains.d\icraft.conf</code></p>
  
  <p>You can drop the <code>index.php?p=</code> part (just use pretty URLs) - if you're still having issues, post your <code>config\general.php</code>, you might have a Craft config issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-31T19:15:42.727Z
Answers.Text: Thanks! I've looked at general.php but didn't make any changes. I've included it above. Even with omitScriptNameInUrls set to true, the login submit is still looking for index.php with args.  Still having trouble logging in. I've simplified my server block to the essentials.
Answers.UserDisplayName: Jim
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T07:52:21.497Z
Answers.Text: It could be a PHP ini setting - sounds like Craft cannot recognize that your server supports pretty paths. I would suggest you start with a clean Winnmp install (latest version 19.03 as of yesterday) and then go into `\winnmp\conf\php.ini` and add at least these changes:
  
  `open_basedir = none`
  `; disable_functions...`
  
  ... and check in Craft CP that it's happy with all server settings in `admin//utilities/system-report`
Answers.UserDisplayName: Jure Srpcic
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T07:57:16.573Z
Answers.Text: And I'd suggest you just start with a completely clean craft install - https://docs.craftcms.com/v3/installation.html - it works out of the box without any changes to any config using WinNmp - so you'll know the issue isn't in a config setting etc.
Answers.UserDisplayName: Jure Srpcic
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-07T17:54:09.383Z
Answers.Text: Thanks for you help. This isn't working for me yet. I've started with clean installs of both WinNMP and Craft, but the login submission is still looking for http://craft.test/index.php?p=maker/actions/users/login in the path. So Craft isn't able to find a template. I've also made the changes to the php.ini. Any other thoughts?
Answers.UserDisplayName: Jim
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-31T18:45:00.533Z
Answers.LastActivityDate: 2019-03-31T18:45:00.533Z
Answers.UserDisplayName: Jure Srpcic
Body: <p>Has anyone had success with using Craft and WTServer (WinNMP) together? I'm getting a 400 error at "<a href="http://craft.test/index.php?p=admintrigger/actions/users/login" rel="nofollow noreferrer">http://craft.test/index.php?p=admintrigger/actions/users/login</a>" after trying to login the admin. I'm suspicious that my Nginx config rewrites aren't working, but unsure how to troubleshoot it. The front-end displays fine, and the login screen works but the login submit throws the 400 error.</p>
  
  <p>nginx server block...</p>
  
  <pre><code>server {
  
  listen      127.0.0.1:80;
  server_name     craft.test craft.dev;
  charset utf-8;
  root    "c:/wtserver/www/craft/web"; # locked
  allow       127.0.0.1;
  deny        all;
  index index.html index.htm index.php;
  ssi on;
  client_max_body_size 0;
  error_page 404 /index.php?$query_string;
  
  location / {
      try_files $uri/index.html $uri $uri/ /index.php?$query_string;
  }
  
  location ~ [^/]\.php(/|$) {
      try_files $uri $uri/ /index.php?$query_string;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      # Change this to whatever version of php you are using
      include     nginx.fastcgi.conf;
      include     nginx.redis.conf;
      fastcgi_pass    php_farm;
      fastcgi_hide_header X-Powered-By;
  
      add_header Last-Modified $date_gmt;
      add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
      if_modified_since off;
      expires off;
      etag off;
  
      fastcgi_intercept_errors off;
      fastcgi_buffer_size 16k;
      fastcgi_buffers 4 16k;
      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
  }
  
  location ~ /\.(ht|svn|git) {
      deny all;
  }
  
  sendfile off;
  </code></pre>
  
  <h3>general.php</h3>
  
  <pre class="lang-PHP prettyprint-override"><code>return [
  // Global settings
  '*' =&gt; [
      // Default Week Start Day (0 = Sunday, 1 = Monday...)
      'defaultWeekStartDay' =&gt; 1,
  
      // Whether generated URLs should omit "index.php"
      'omitScriptNameInUrls' =&gt; true,
  
      // Control Panel trigger word
      'cpTrigger' =&gt; 'admintrigger',
  
      // The secure key Craft will use for hashing and encrypting data
      'securityKey' =&gt; getenv('SECURITY_KEY'),
  
      // Whether to save the project config out to config/project.yaml
      // (see https://docs.craftcms.com/v3/project-config.html)
      'useProjectConfigFile' =&gt; false,
  ],
  
  // Dev environment settings
  'dev' =&gt; [
      // Dev Mode (see https://craftcms.com/guides/what-dev-mode-does)
      'devMode' =&gt; true,
  ],
  
  // Staging environment settings
  'staging' =&gt; [
      // Set this to `false` to prevent administrative changes from being made on staging
      'allowAdminChanges' =&gt; true,
  ],
  
  // Production environment settings
  'production' =&gt; [
      // Set this to `false` to prevent administrative changes from being made on production
      'allowAdminChanges' =&gt; true,
  ],
  </code></pre>
  
  <h3>Error in the Network console...</h3>
  
  <p><a href="https://i.sstatic.net/rX4tP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rX4tP.png" alt="enter image description here"></a></p>
  
  <h3>404s...</h3>
  
  <p>2019-04-07 10:54:44 [-][-][dc567ad367247e3bf37e7ce11ac60e93][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: favicon.ico in C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\controllers\TemplatesController.php:70
  Stack trace:
  0 [internal function]: craft\controllers\TemplatesController->actionRender('favicon.ico', Array)
  1 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
  2 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
  3 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Controller.php(109): yii\base\Controller->runAction('render', Array)
  4 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller->runAction('render', Array)
  5 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(297): yii\base\Module->runAction('templates/rende...', Array)
  6 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\web\Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
  7 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(286): yii\web\Application->handleRequest(Object(craft\web\Request))
  8 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
  9 C:\WinNMP\WWW\craft\web\index.php(21): yii\base\Application->run()
  10 {main}</p>
  
Tags: <craft3><nginx><yii>
Title: CraftCMS config on WTServer / WinNMP for Windows with Nginx
ThreadText: # CraftCMS config on WTServer / WinNMP for Windows with Nginx
  
  (Asked by: username_0 on 2019-03-31)
  
  Has anyone had success with using Craft and WTServer (WinNMP) together? I'm getting a 400 error at "<http://craft.test/index.php?p=admintrigger/actions/users/login>" after trying to login the admin. I'm suspicious that my Nginx config rewrites aren't working, but unsure how to troubleshoot it. The front-end displays fine, and the login screen works but the login submit throws the 400 error.
  
  nginx server block...
  
  ```
  server {
  
  listen      127.0.0.1:80;
  server_name     craft.test craft.dev;
  charset utf-8;
  root    "c:/wtserver/www/craft/web"; # locked
  allow       127.0.0.1;
  deny        all;
  index index.html index.htm index.php;
  ssi on;
  client_max_body_size 0;
  error_page 404 /index.php?$query_string;
  
  location / {
      try_files $uri/index.html $uri $uri/ /index.php?$query_string;
  }
  
  location ~ [^/]\.php(/|$) {
      try_files $uri $uri/ /index.php?$query_string;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      # Change this to whatever version of php you are using
      include     nginx.fastcgi.conf;
      include     nginx.redis.conf;
      fastcgi_pass    php_farm;
      fastcgi_hide_header X-Powered-By;
  
      add_header Last-Modified $date_gmt;
      add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
      if_modified_since off;
      expires off;
      etag off;
  
      fastcgi_intercept_errors off;
      fastcgi_buffer_size 16k;
      fastcgi_buffers 4 16k;
      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
  }
  
  location ~ /\.(ht|svn|git) {
      deny all;
  }
  
  sendfile off;
  
  ```
  
  ### general.php
  
  ```PHP
  return [
  // Global settings
  '*' => [
      // Default Week Start Day (0 = Sunday, 1 = Monday...)
      'defaultWeekStartDay' => 1,
  
      // Whether generated URLs should omit "index.php"
      'omitScriptNameInUrls' => true,
  
      // Control Panel trigger word
      'cpTrigger' => 'admintrigger',
  
      // The secure key Craft will use for hashing and encrypting data
      'securityKey' => getenv('SECURITY_KEY'),
  
      // Whether to save the project config out to config/project.yaml
      // (see https://docs.craftcms.com/v3/project-config.html)
      'useProjectConfigFile' => false,
  ],
  
  // Dev environment settings
  'dev' => [
      // Dev Mode (see https://craftcms.com/guides/what-dev-mode-does)
      'devMode' => true,
  ],
  
  // Staging environment settings
  'staging' => [
      // Set this to `false` to prevent administrative changes from being made on staging
      'allowAdminChanges' => true,
  ],
  
  // Production environment settings
  'production' => [
      // Set this to `false` to prevent administrative changes from being made on production
      'allowAdminChanges' => true,
  ],
  
  ```
  
  ### Error in the Network console...
  
  [![enter image description here](https://i.sstatic.net/rX4tP.png)](https://i.sstatic.net/rX4tP.png)
  
  ### 404s...
  
  2019-04-07 10:54:44 [-][-][dc567ad367247e3bf37e7ce11ac60e93][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Template not found: favicon.ico in C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\controllers\TemplatesController.php:70
  Stack trace:
  0 [internal function]: craft\controllers\TemplatesController->actionRender('favicon.ico', Array)
  1 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\InlineAction.php(57): call\_user\_func\_array(Array, Array)
  2 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
  3 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Controller.php(109): yii\base\Controller->runAction('render', Array)
  4 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller->runAction('render', Array)
  5 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(297): yii\base\Module->runAction('templates/rende...', Array)
  6 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\web\Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
  7 C:\WinNMP\WWW\craft\vendor\craftcms\cms\src\web\Application.php(286): yii\web\Application->handleRequest(Object(craft\web\Request))
  8 C:\WinNMP\WWW\craft\vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
  9 C:\WinNMP\WWW\craft\web\index.php(21): yii\base\Application->run()
  10 {main}
  
  **Tags:** craft3, nginx, yii
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-04-09. Score: 0 | Accepted answer
  
  For me, this didn't have anything to do with rewrites. I installed WTServer (WinNMP) and a fresh copy of Craft.
  
  I noticed the same 400 response when trying to log in and was seeing this in the body:
  
  > 400 Request Header Or Cookie Too Large
  
  After a quick Google, I noticed that the default nginx config that WTServer has these set:
  
  ```
  client_header_buffer_size   1k;
  large_client_header_buffers 2 1k;
  
  ```
  
  I bumped those up to this:
  
  ```
  client_header_buffer_size   8k;
  large_client_header_buffers 8 16k;
  
  ```
  
  Restarted nginx and everything started working fine.
  
  > **Comments:**
  > **username_0**: Boom! Thanks so much username_1. Huge Craft points. You just made me more willing to dive in.  
  
  ---
  
  ### Answer by username_2 on 2019-03-31. Score: 1
  
  This is my clean wtserver/winnmp nginx conf file for Craft (and pretty much anything else like Laravel etc.).
  
  ```
  server {
  
      listen          127.0.0.1:80;
      server_name     icraft.test; # locked
      root            "c:\web\icraft\public"; # locked
  
      allow           127.0.0.1;
      deny            all;
      autoindex       on;
  
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
  
      location ~ \.php$ {
          try_files $uri =404;
          include         nginx.fastcgi.conf;
          include         nginx.redis.conf;
          fastcgi_pass    php_farm;
      }
  
  }
  
  ```
  
  Assuming you installed winnmp to `c:\web\winnmp`, this file would go to `c:\web\winnmp\conf\domains.d\icraft.conf`
  
  You can drop the `index.php?p=` part (just use pretty URLs) - if you're still having issues, post your `config\general.php`, you might have a Craft config issue.
  
  > **Comments:**
  > **username_0**: Thanks! I've looked at general.php but didn't make any changes. I've included it above. Even with omitScriptNameInUrls set to true, the login submit is still looking for index.php with args.  Still having trouble logging in. I've simplified my server block to the essentials.  
  > **username_2**: It could be a PHP ini setting - sounds like Craft cannot recognize that your server supports pretty paths. I would suggest you start with a clean Winnmp install (latest version 19.03 as of yesterday) and then go into `\winnmp\conf\php.ini` and add at least these changes:  `open_basedir = none` `; disable_functions...`  ... and check in Craft CP that it's happy with all server settings in `admin//utilities/system-report`  
  > **username_2**: And I'd suggest you just start with a completely clean craft install - https://docs.craftcms.com/v3/installation.html - it works out of the box without any changes to any config using WinNmp - so you'll know the issue isn't in a config setting etc.  
  > **username_0**: Thanks for you help. This isn't working for me yet. I've started with clean installs of both WinNMP and Craft, but the login submission is still looking for http://craft.test/index.php?p=maker/actions/users/login in the path. So Craft isn't able to find a template. I've also made the changes to the php.ini. Any other thoughts?  
  
  ---
  
  