<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 24, 2020 at 11:40 PM Kaushal Shriyan <<a href="mailto:kaushalshriyan@gmail.com">kaushalshriyan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,<br></div><div><br></div><div>I have two nginx.conf file /etc/nginx/conf.d/onetest.conf and /etc/nginx/nginx.conf. Basically the first config file works without any issue while redirecting from port 80 to 443. I want to enable the port redirect from port 80 to 443 in /etc/nginx/nginx.conf. when I add the below block in /etc/nginx/nginx.conf, I am facing <b>a duplicate default server for <a href="http://0.0.0.0:80" target="_blank">0.0.0.0:80</a> in /etc/nginx/nginx.conf:39 </b> I</div><div><br>      listen       80 default_server;<br>      server_name <a href="http://abtddeveloperportal.mydomain.com" target="_blank">abtddeveloperportal.mydomain.com</a>;<br>      return       301 https://$server_name$request_uri;<br>}<br></div><div><br></div><br>####################################cat /etc/nginx/conf.d/onetest.conf######################################################################<br>cat /etc/nginx/conf.d/onetest.conf<br>server {<br>      listen       80 default_server;<br>      server_name  <a href="http://onetest.mydomain.io" target="_blank">onetest.mydomain.io</a>;<br>      return       301 https://$server_name$request_uri;<br>}<br><br><br>server {<br>        listen 443 ssl;<br>        server_name <a href="http://onetest.mydomain.io" target="_blank">onetest.mydomain.io</a>;<br>        ssl_protocols          TLSv1.3 TLSv1.2;<br>        ssl_certificate /etc/ssl/<a href="http://onetest.mydomain.io/fullchain1.pem" target="_blank">onetest.mydomain.io/fullchain1.pem</a>; ssl_certificate_key /etc/ssl/<a href="http://onetest.mydomain.io/privkey1.pem" target="_blank">onetest.mydomain.io/privkey1.pem</a>;<br>        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;<br>        ssl_prefer_server_ciphers on;<br>        ssl_dhparam /etc/ssl/<a href="http://onetest.mydomain.io/dhparam.pem" target="_blank">onetest.mydomain.io/dhparam.pem</a>;<br>        client_max_body_size 100M;<br>        root         /var/www/newtheme/testuatplace-v2/mpV2/web/;<br><br><br>location = /favicon.ico {<br>        log_not_found off;<br>        access_log off;<br>    }<div><br></div><div>#####################################################################################################################################<br><br><br>####################################cat /etc/nginx/nginx.conf######################################################################<br><br><br>    server {<br>      listen       80 default_server;<br>      server_name <a href="http://abtddeveloperportal.mydomain.com" target="_blank">abtddeveloperportal.mydomain.com</a>;<br>      return       301 https://$server_name$request_uri;<br>}<br><br><br>    server {<br>        listen 443 ssl;<br>        server_name <a href="http://abtddeveloperportal.mydomain.com" target="_blank">abtddeveloperportal.mydomain.com</a>;<br>        ssl_protocols          TLSv1.3 TLSv1.2;<br>        ssl_certificate /etc/ssl/<a href="http://abtddeveloperportal.mydomain.com/fullchain3.pem" target="_blank">abtddeveloperportal.mydomain.com/fullchain3.pem</a>; ssl_certificate_key /etc/ssl/<a href="http://abtddeveloperportal.example.com/privkey3.pem" target="_blank">abtddeveloperportal.example.com/privkey3.pem</a>;<br>        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;<br>        ssl_prefer_server_ciphers on;<br>        ssl_dhparam /etc/ssl/<a href="http://abtddeveloperportal.mydomain.com/dhparam.pem" target="_blank">abtddeveloperportal.mydomain.com/dhparam.pem</a>;<br>        client_max_body_size 100M;<br>        #listen       [::]:80 default_server;<br>        root         /var/www/drupal/testplace-v2/mpV2/web;<br>#######################################################################################################################################################<br><br><br><div>#nginx -t -c /etc/nginx/nginx.conf</div><div>nginx: [emerg] a duplicate default server for <a href="http://0.0.0.0:80" target="_blank">0.0.0.0:80</a> in /etc/nginx/nginx.conf:39<br>nginx: configuration file /etc/nginx/nginx.conf test failed<br></div></div><div><br></div><div>Is there a way to enable redirect from port 80 to 443 for both /etc/nginx/conf.d/onetest.conf and /etc/nginx/nginx.conf files.  Any help will be highly appreciated. </div><div><br></div><div>Thanks in Advance.</div><div><br></div><div>Best Regards,</div><div><br></div><div>Kaushal</div></div></blockquote><div><br></div><div>Hi,</div><div><br></div><div>I will appreciate if someone can pitch in for my earlier email to this mailing list. Thanks in Advance.</div><div><br></div><div>Best Regards,</div><div><br></div><div>Kaushal </div></div></div>