「🏗️」 wip: should be working but not
This commit is contained in:
@ -1,22 +1,8 @@
|
||||
#!/bin/sh
|
||||
if [ ! -v ${PRODUCTION} ]; then
|
||||
if [ ! -f ${NGINX_SSL_KEY_FILE} ]; then
|
||||
echo "Generating certs"
|
||||
mkdir -p /etc/nginx/ssl
|
||||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ${NGINX_SSL_KEY_FILE} -out ${NGINX_SSL_CERT_FILE} -subj "/C=FR/ST=IDF/L=Angouleme/O=42/OU=42/CN=adjoly.42.fr/UID=adjoly"
|
||||
else
|
||||
printf "Key already exist not recreating\n"
|
||||
fi
|
||||
else
|
||||
printf "Entering production mode for nginx"
|
||||
INPUT_FILE="/etc/nginx/http.d/www.conf"
|
||||
OUTPUT_FILE="/etc/nginx/http.d/www.conf"
|
||||
sed -E '
|
||||
s/listen\s+443 ssl;/listen 80;/;
|
||||
s/server_name.*/&\n\tlisten 80;/;
|
||||
/ssl_certificate/d;
|
||||
/ssl_certificate_key/d;
|
||||
/ssl_protocols/d;
|
||||
/ssl_session_timeout/d;
|
||||
' "$INPUT_FILE" > "$OUTPUT_FILE"
|
||||
if [ ! -f ${NGINX_SSL_KEY_FILE} ]; then
|
||||
echo "Generating certs"
|
||||
mkdir -p /etc/nginx/ssl
|
||||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ${NGINX_SSL_KEY_FILE} -out ${NGINX_SSL_CERT_FILE} -subj "/C=FR/ST=IDF/L=Angouleme/O=42/OU=42/CN=adjoly.42.fr/UID=adjoly"
|
||||
else
|
||||
printf "Key already exist not recreating\n"
|
||||
fi
|
||||
|
24
srcs/configs/nginx/templates-dev/www.conf.template
Normal file
24
srcs/configs/nginx/templates-dev/www.conf.template
Normal file
@ -0,0 +1,24 @@
|
||||
server {
|
||||
listen localhost:443 ssl;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php;
|
||||
|
||||
ssl_certificate $NGINX_SSL_CERT_FILE;
|
||||
ssl_certificate_key $NGINX_SSL_KEY_FILE;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
keepalive_timeout 60;
|
||||
|
||||
location / {
|
||||
try_files $${q}uri $${q}uri/ =404;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass $NGINX_PHP_HOST:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user