title: wordpress + nginx + django: error too many redirect
body: <p>I have just included wordpress into a project to replace django for the landing page of the website. Up to that point everything server related is working just fine. I am a bit wary to make modification to nginx configuration because I am far from an expert in the domain.</p>
  <p>I have tried including wordpress location by disabling what I had before which was from django and it is resulting in <code>ERROR TOO MANY REDIRECT</code></p>
  <p>here is the code for <code>/nginx/sites-enabled/conf.d</code> that I have:</p>
  <pre><code>server {
      server_name  mysite.com www.mysite.com;
      root /var/www/html;
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot 
  location ^~ / {
          alias /home/ubuntu/var/www/html/wordpress;
  
          index index.php;
          if (!-e $request_filename) { rewrite ^ /index.php last; }
  
          location ~ /wp-content/uploads/ { expires 30d; }
  
          location ~ \.php$ {
  if (!-f $request_filename) { rewrite ^ /index.php last; }
  
              include       fastcgi_params;
              fastcgi_param SCRIPT_FILENAME $request_filename;
  
          }
          location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
              if (!-f $request_filename) { rewrite ^ /index.php last; }
              expires 30d;
          }
      }
  
  }
  
  
  server {
    if ($host = www.mysite.com) {
          return 301 https://$host$request_uri;
      listen 80;
      server_name  mysite.com www.mysite.com;
      return 404; # managed by Certbot
  
      location ^~ / {
          alias /home/ubuntu/var/www/html/wordpress;
  
          index index.php;
          if (!-e $request_filename) { rewrite ^ /index.php last; }
  
          location ~ /wp-content/uploads/ { expires 30d; }
  
          location ~ \.php$ {
              if (!-f $request_filename) { rewrite ^ /index.php last; }
  
              include       fastcgi_params;
              fastcgi_param SCRIPT_FILENAME $request_filename;
  
          }
          location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
              if (!-f $request_filename) { rewrite ^ /index.php last; }
              expires 30d;
          }
      }
  
  
  }
  </code></pre>
  <p>and here is my wp-config file, I have not add anything to it beside db info:</p>
  <pre><code>&lt;?php
  /**
   * The base configuration for WordPress
   *
   * The wp-config.php creation script uses this file during the
   * installation. You don't have to use the web site, you can
   * copy this file to &quot;wp-config.php&quot; and fill in the values.
   *
   * This file contains the following configurations:
   *
   * * MySQL settings
   * * Secret keys
   * * Database table prefix
   * * ABSPATH
   *
   * @link https://wordpress.org/support/article/editing-wp-config-php/
   *
   * @package WordPress
   */
  
  // ** MySQL settings - You can get this info from your web host ** //
  /** The name of the database for WordPress */
  define( 'DB_NAME', 'dbsite1' );
  
  /** MySQL database username */
  define( 'DB_USER', 'root' );
  
  /** MySQL database password */
  define( 'DB_PASSWORD', 'password' );
  
  /** MySQL hostname */
  define( 'DB_HOST', 'host' );
  
  /** Database Charset to use in creating database tables. */
  define( 'DB_CHARSET', 'utf8' );
  
  /** The Database Collate type. Don't change this if in doubt. */
  define( 'DB_COLLATE', '' );
  
  /**#@+
   * Authentication Unique Keys and Salts.
   *
   * Change these to different unique phrases!
   * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
   * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
   *
   * @since 2.6.0
   */
  define( 'AUTH_KEY',         'put your unique phrase here' );
  define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
  define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
  define( 'NONCE_KEY',        'put your unique phrase here' );
  define( 'AUTH_SALT',        'put your unique phrase here' );
  define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
  define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
  define( 'NONCE_SALT',       'put your unique phrase here' );
  
  $table_prefix = 'wp_';
  
  /**
   * For developers: WordPress debugging mode.
   *
   * Change this to true to enable the display of notices during development.
   * It is strongly recommended that plugin and theme developers use WP_DEBUG
   * in their development environments.
   *
   * For information on other constants that can be used for debugging,
   * visit the documentation.
   *
   * @link https://wordpress.org/support/article/debugging-in-wordpress/
   */
  define( 'WP_DEBUG', false );
  
  /* That's all, stop editing! Happy publishing. */
  
  /** Absolute path to the WordPress directory. */
  if ( ! defined( 'ABSPATH' ) ) {
          define( 'ABSPATH', __DIR__ . '/' );
  }
  
  /** Sets up WordPress vars and included files. */
  require_once ABSPATH . 'wp-settings.php';
  
  
  
  </code></pre>
  <p>I have been investigating for a few hours now but I figure out what is wrong and I am worried I will accidently break something crucial. Wondering if someone can see where i am messing up</p>