nginx and favicon done

This commit is contained in:
Adrien Audebert
2024-09-16 20:15:36 +02:00
parent f5c5c5dd7f
commit 39b6f1a17c
7 changed files with 54 additions and 38 deletions

View File

@@ -1,9 +1,11 @@
server {
listen 80;
#server_name yourdomain.com;
server_name localhost;
# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;
location / {
return 301 https://localhost:1443$request_uri;
}
}
server {
@@ -14,17 +16,14 @@ server {
ssl_certificate_key /etc/nginx/ssl/private.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
root /usr/share/nginx/html;
index index.html;
ssl_prefer_server_ciphers on;
# Proxy normal HTTP requests to Django
location / {
proxy_pass http://backend:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://backend:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

28
config/ssl.conf Normal file
View File

@@ -0,0 +1,28 @@
[req]
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = req_ext
[req_distinguished_name]
countryName = FR
countryName_default = FR
stateOrProvinceName = Pyrénées Orientales
stateOrProvinceName_default = Pyrénées Orientales
localityName = Perpignan
localityName_default = Perpignan
organizationName = 42Perpignan
organizationName_default = 42Perpignan
commonName = www.ft_transcendence.com
commonName_default = localhost
[req_ext]
subjectAltName = @alt_names
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
[alt_names]
DNS.1 = localhost
DNS.2 = www.ft_transcendence.com
DNS.3 = ft_transcendence.com
IP.1 = 127.0.0.1