diff --git a/docker-compose.yml b/docker-compose.yml index 8cdef1d..468f09e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,9 +14,12 @@ services: container_name: laravel_web restart: always ports: - - "8000:80" # C'est ce port 8000 qu'il faudra mettre dans NPM ! + - "8000:80" + - "8443:443" # HTTPS port volumes: - .:/var/www - - ./nginx.conf:/etc/nginx/conf.d/default.conf # On va créer ce petit fichier + - ./nginx.conf:/etc/nginx/conf.d/default.conf + - ./cert.pem:/var/www/cert.pem + - ./cert.key:/var/www/cert.key depends_on: - app \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 79f8017..5dc3d00 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,12 +1,21 @@ server { listen 80; + server_name localhost; + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl; + server_name localhost; + ssl_certificate /var/www/cert.pem; + ssl_certificate_key /var/www/cert.key; index index.php index.html; - root /var/www/public; # ICI est le secret du "Not Found" + root /var/www/public; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass app:9000; # Il parle au conteneur 'app' + fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;