Laravel Homestead - SSL Setting

I'm trying to start using a tramp for development - I'm not used to using a firewall for my development - I rely on apache / php / mysql configured on a laptop.

I am developing with laravel and creating a homestead and I am working.

I tried to enable SSL in homestead (field?) And followed the following instructions to configure: https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu -12-04

I made changes to the homestead sites_enabled file for the site I'm working on.

I added port 443 only under port 80 inside the server, added entries for SSL On, etc.

I restarted the nginx server and can see my pages using https (although chrome doesn't like the certificate)

If I try to access pages using http, I get 400 error The plain HTTP request was sent to HTTPS port

so a few questions: 1. How can I change the settings to use a combination of HTTP and HTTPS requests? 2. Bad practice is to serve the site using HTTP and HTTPS requests. Should I just serve the whole site as https?

Very confused with a completely new subject

thanks

+4
source share
2 answers

Add port forwarding to estate 1.x

You need to forward the SSL port by adding a new line to homestead.rb

 sudo nano /vagrant/scripts/homestead.rb # add SSL port forwarding ... config.vm.network "forwarded_port", guest: 443, host: 44300 

Create SSL Certificate

Steps one to four

Follow steps four only from this tutorial https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04

Step Five - Configure Certificate

Edit your estate site that you are working on (replace the example with your existing site)

 sudo nano /etc/nginx/sites-available/example 

Duplicate the entire server{…} section (and not just the listen line, as you did). In the duplicated section, edit listen 80 to listen 443 .

Add the following lines to the end of the section:

 ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; 

exit and do vagrant reload .

Be careful with --provision . The changes to sites-available/example that you just made are reset to default.

If you need to make changes forever, even in case of provision, look at serve.sh located in the host folder of the host homstead/scripts/serve.sh and edit it equally in step 5.

Use https://your.domain:44300 in your browser to access via SSL. If necessary, accept the self-signed certificate in your browser.

+7
source

In addition to Peh. I did not work with the above code:

I needed to remove

 SSL on 

and add ssl to the listener

 listen 443 ssl; 
+1
source

Source: https://habr.com/ru/post/1273671/


All Articles