redirect from http (port 80) to https (port 443) not working.

Kaushal Shriyan kaushalshriyan at gmail.com
Mon Jun 15 17:01:15 UTC 2020


Hi,

I am running nginx version: nginx/1.16.1 on CentOS Linux release 7.8.2003
(Core). When I hit https://marketplace.mydomain.com it works perfectly fine
whereas when I hit http://marketplace.mydomain.com (port 80) does not get
redirected to https://marketplace.mydomain.com (port 443). I have the below
nginx.conf.

server {
>         listen 443 ssl default_server;
>         #listen       80 default_server;
>         #server_name  _;
>         server_name marketplace.mydomain.com;
>         ssl_protocols TLSv1.2;
>         ssl_certificate /etc/ssl/certs/
> marketplace.mydomain.com/fullchain1.pem; ssl_certificate_key
> /etc/ssl/certs/marketplace.mydomain.com/privkey1.pem;
>         if ($scheme = http) { return 301 https://$server_name$request_uri;
> }
>         ssl_ciphers
> ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
>         ssl_prefer_server_ciphers on;
>         ssl_dhparam /etc/ssl/certs/marketplace.mydomain.com/dhparam.pem;
>         client_max_body_size 100M;
>         root         /var/www/drupal/marketplace-v2/mpV2/web;
>         access_log  /var/log/nginx/access.log;
>         error_log  /var/log/nginx/error.log;
>         # Load configuration files for the default server block.
>         include /etc/nginx/default.d/*.conf;
>         location = /favicon.ico {
>         log_not_found off;
>         access_log off;
>         }


I will appreciate it if someone can pitch in for help. Please let me know
if you need any additional configurations and I look forward to hearing
from you. Thanks in Advance.

Best Regards,

Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200615/7cd83acb/attachment.htm>


More information about the nginx mailing list