init repository
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
FROM nginx:stable-alpine3.17-slim
|
||||
|
||||
# embed the configuration directly in the image
|
||||
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY nginx/cors_preflight.conf /etc/nginx/cors_preflight.conf
|
||||
|
||||
# init ssl connection
|
||||
RUN mkdir /etc/nginx/ssl
|
||||
COPY nginx/ssl/certificate.crt nginx/ssl/private.key /etc/nginx/ssl/
|
||||
@@ -0,0 +1,7 @@
|
||||
# add_header 'Access-Control-Allow-Origin' 'https://my-front:5173' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
||||
add_header 'Access-Control-Max-Age' 1728000 always;
|
||||
# add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
# add_header 'Content-Length' 0;
|
||||
@@ -0,0 +1,26 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# upstream my-microservice {
|
||||
# server my-microservice:8083;
|
||||
# }
|
||||
|
||||
include /etc/nginx/cors_preflight.conf;
|
||||
|
||||
server {
|
||||
# location /my-microservice {
|
||||
# if ($request_method = 'OPTIONS') {
|
||||
# return 204;
|
||||
# }
|
||||
# proxy_pass http://my-microservice/my-microservice;
|
||||
# }
|
||||
|
||||
listen 4443 ssl;
|
||||
ssl_certificate /etc/nginx/ssl/certificate.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/private.key;
|
||||
|
||||
resolver 127.0.0.11;
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
# generate private key
|
||||
openssl genpkey -algorithm RSA -out private.key -pkeyopt rsa_keygen_bits:2048
|
||||
|
||||
# generate cert sign request
|
||||
openssl req -new -key private.key -out csr.csr -subj "/C=EN/ST=Anywhere/L=Where/O=Organization/OU=localenv/CN=localenv.io"
|
||||
|
||||
# generate self signed certificate
|
||||
openssl x509 -req -days 3650 -in csr.csr -signkey private.key -out certificate.crt
|
||||
|
||||
# if you need to import certificate into your browser
|
||||
# openssl pkcs12 -export -in certificate.crt -inkey private.key -out server.p12
|
||||
Reference in New Issue
Block a user