Laravel Forge Nginx configuration for SSL

I usually don't post questions until I've researched it to death on the internet. I create CSR using Laravel Forge, add certificate, activate it, edit Nginx Config using these resources:

https://stackoverflow.com/questions/26192839/laravel-forge-ssl-certificate-not-working

^ curl https://domain.com returns data

server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://example.com$request_uri;
}

server {
  listen 443 ssl;
  server_name example.com www.example.com;
  root /home/forge/example.com/public;

  # FORGE SSL (DO NOT REMOVE!)
  ssl_certificate /etc/nginx/ssl/vgport.com/3042/server.crt;
  ssl_certificate_key /etc/nginx/ssl/vgport.com/3042/server.key;

  index index.html index.htm index.php;

  charset utf-8;

  location / {
      try_files $uri $uri/ /index.php?$query_string;
  }

  location = /favicon.ico { access_log off; log_not_found off; }
  location = /robots.txt  { access_log off; log_not_found off; }

  access_log off;
  error_log  /var/log/nginx/default-error.log error;

  error_page 404 /index.php;

  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
  }

  location ~ /\.ht {
      deny all;
  }
}

      

I am doing "nginx restart service" on the command line and go to /var/log/nginx/error.log and see the following error:

'conflicting server name "" on 0.0.0.0:80, ignored'
'conflicting server name "www.domain.com" on 0.0.0.0:80, ignored'

      

When I am on a .com domain it is redirected to https://domain.com with "This web page has a redirect loop." Obviously Nginx redirect doesn't work, but I followed all the steps.

Please let me know what additional error logs and information I should post to fix this issue. Any help would be greatly appreciated, in advance.

+3


source to share


2 answers


ok so the problem was simpler than i thought. I used free dns cloud notation which didn't support ssl. I switched to using dns namescheap and it started working.



+3


source


After spending some time learning nginx, I would just like to add that when adding a certificate, you need to manually click on "Activate it" after uploading.



0


source







All Articles