title: Redirecting to SSL using Nginx
body: <p>I have http:// and https:// on the same host like the following:</p>
  <pre><code>server {
  
      listen   80;
      listen   443 ssl;
  
      ...
      ...
  }
  </code></pre>
  <p>What I need to do is redirecting users who access my shop to <code>https://</code>. The problem is I have many languages:</p>
  <ul>
  <li><code>https://example.com/en/shop</code></li>
  <li><code>https://example.com/fr/shop</code></li>
  <li>etc...</li>
  </ul>
  <p>I tried this and it didn't work <code>(nginx: configuration file /etc/nginx/nginx.conf test failed)</code>:</p>
  <pre><code>if ($server_port = 80) {
      location (en|fr)/shop {
          rewrite ^ https://$host$request_uri permanent;
      }
  }
  </code></pre>