-
-
Save zinderud/70e85572d31ce62856fab58abd4d3d75 to your computer and use it in GitHub Desktop.
Serving Angular CLI project over HTTPS / generate SSL cert / configure Angular CLI / optionally use NGINX via Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker run --name fc \ | |
-v $PWD/ssl:/etc/nginx/certs \ | |
-v $PWD/ssl/nginx-default.conf:/etc/nginx/conf.d/default.conf:ro \ | |
-v $PWD/dist/___PROJECT_NAME___:/usr/share/nginx/html:ro -p 8080:443 -d nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
openssl req \ | |
-newkey rsa:2048 \ | |
-x509 \ | |
-nodes \ | |
-keyout server.key \ | |
-new \ | |
-out server.crt \ | |
-config ./openssl-custom.cnf \ | |
-sha256 \ | |
-days 365 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo cp server.crt /etc/ca-certificates/trust-source/anchors/ | |
sudo update-ca-trust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl; | |
server_name localhost; | |
ssl_certificate /etc/nginx/certs/server.crt; | |
ssl_certificate_key /etc/nginx/certs/server.key; | |
#charset koi8-r; | |
#access_log /var/log/nginx/host.access.log main; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |
# | |
#location ~ \.php$ { | |
# proxy_pass http://127.0.0.1; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
#location ~ \.php$ { | |
# root html; | |
# fastcgi_pass 127.0.0.1:9000; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | |
# include fastcgi_params; | |
#} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
#location ~ /\.ht { | |
# deny all; | |
#} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[req] | |
default_bits = 2048 | |
prompt = no | |
default_md = sha256 | |
x509_extensions = v3_req | |
distinguished_name = dn | |
[dn] | |
C = US | |
ST = KS | |
L = Olathe | |
O = IT | |
OU = IT Department | |
emailAddress = webmaster@example.com | |
CN = localhost | |
[v3_req] | |
subjectAltName = @alt_names | |
[alt_names] | |
DNS.1 = *.localhost | |
DNS.2 = localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"start:dev": "ng serve --ssl true --ssl-cert ssl/server.crt --ssl-key ssl/server.key", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment