nginx ssl connection works, it was a typo
+ created some test files in html
This commit is contained in:
2
Makefile
2
Makefile
@@ -35,6 +35,8 @@ VOLUMES = v_wp_site \
|
||||
|
||||
CONTAINERS = $(IMAGES:%=my%)
|
||||
|
||||
CONT = mytest
|
||||
|
||||
SUDO =
|
||||
|
||||
|
||||
|
||||
11
README.md
11
README.md
@@ -52,9 +52,6 @@
|
||||
|
||||
- [download alpine linux](https://alpinelinux.org/downloads/)
|
||||
- [dockerhub alpine image](https://hub.docker.com/_/alpine)
|
||||
- [run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||
- [run docker deamon rootless](https://docs.docker.com/engine/security/rootless/)
|
||||
- [dangling images '<none>'](https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/)
|
||||
|
||||
#### docker :
|
||||
- [docker starter guide](https://docs.docker.com/get-started/)
|
||||
@@ -63,6 +60,11 @@
|
||||
- [determine the parent image](https://forums.docker.com/t/determine-the-parent-image/48611)
|
||||
- [docker image from scratch](https://codeburst.io/docker-from-scratch-2a84552470c8)
|
||||
- [build context and image context](https://stackoverflow.com/questions/55108649/what-is-app-working-directory-for-a-dockerfile/55109065#55109065)
|
||||
- [run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||
- [run docker deamon rootless](https://docs.docker.com/engine/security/rootless/)
|
||||
- [dangling images '<none>'](https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/)
|
||||
- [go inside docker to debug it](https://docs.docker.com/engine/reference/commandline/container_exec/)
|
||||
- `docker exec -ti <container-name> bash` to run bash inside a running container
|
||||
|
||||
###### docker pid 1
|
||||
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
|
||||
@@ -117,6 +119,9 @@
|
||||
#### nginx
|
||||
- [nginx begginer guide](https://hub.docker.com/_/nginx/)
|
||||
- [nginx all directives for conf file](https://nginx.org/en/docs/dirindex.html)
|
||||
- [conf file in conf.d or sites-available ?](https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx#answer-870709)
|
||||
- [command line parameters](https://nginx.org/en/docs/switches.html)
|
||||
- `sudo nginx -t` will launch a test to evaluate config file
|
||||
|
||||
#### openssl
|
||||
- [openssl faq](https://www.openssl.org/docs/faq.html)
|
||||
|
||||
@@ -2,6 +2,9 @@ FROM debian:buster
|
||||
|
||||
RUN apt update && apt install -y nginx openssl
|
||||
|
||||
# for debug
|
||||
RUN apt install -y procps vim
|
||||
|
||||
# create ssl certificate
|
||||
RUN openssl req -newkey rsa:2048 -nodes -x509 \
|
||||
-keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \
|
||||
@@ -13,7 +16,7 @@ COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
|
||||
|
||||
# for test
|
||||
COPY ./conf/index.html /data/www/
|
||||
COPY ./conf/salade.jpeg /data/images/
|
||||
COPY ./conf/https/index.html /data/wwws/
|
||||
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
||||
|
||||
|
||||
91
srcs/requirements/nginx/conf/default
Normal file
91
srcs/requirements/nginx/conf/default
Normal file
@@ -0,0 +1,91 @@
|
||||
##
|
||||
# You should look at the following URL's in order to grasp a solid understanding
|
||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||
# https://www.nginx.com/resources/wiki/start/
|
||||
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||
#
|
||||
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||
# leave it as reference inside of sites-available where it will continue to be
|
||||
# updated by the nginx packaging team.
|
||||
#
|
||||
# This file will automatically load configuration files provided by other
|
||||
# applications, such as Drupal or Wordpress. These applications will be made
|
||||
# available underneath a path with that package name, such as /drupal8.
|
||||
#
|
||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||
##
|
||||
|
||||
# Default server configuration
|
||||
#
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
# SSL configuration
|
||||
#
|
||||
# listen 443 ssl default_server;
|
||||
# listen [::]:443 ssl default_server;
|
||||
#
|
||||
# Note: You should disable gzip for SSL traffic.
|
||||
# See: https://bugs.debian.org/773332
|
||||
#
|
||||
# Read up on ssl_ciphers to ensure a secure configuration.
|
||||
# See: https://bugs.debian.org/765782
|
||||
#
|
||||
# Self signed certs generated by the ssl-cert package
|
||||
# Don't use them in a production server!
|
||||
#
|
||||
# include snippets/snakeoil.conf;
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
# Add index.php to the list if you are using PHP
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
# First attempt to serve request as file, then
|
||||
# as directory, then fall back to displaying a 404.
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# pass PHP scripts to FastCGI server
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# include snippets/fastcgi-php.conf;
|
||||
#
|
||||
# # With php-fpm (or other unix sockets):
|
||||
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
||||
# # With php-cgi (or other tcp sockets):
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# Virtual Host configuration for example.com
|
||||
#
|
||||
# You can move that to a different file under sites-available/ and symlink that
|
||||
# to sites-enabled/ to enable it.
|
||||
#
|
||||
#server {
|
||||
# listen 80;
|
||||
# listen [::]:80;
|
||||
#
|
||||
# server_name example.com;
|
||||
#
|
||||
# root /var/www/example.com;
|
||||
# index index.html;
|
||||
#
|
||||
# location / {
|
||||
# try_files $uri $uri/ =404;
|
||||
# }
|
||||
#}
|
||||
1
srcs/requirements/nginx/conf/https/index.html
Normal file
1
srcs/requirements/nginx/conf/https/index.html
Normal file
@@ -0,0 +1 @@
|
||||
you are on https connection, yeah
|
||||
@@ -1,24 +1,29 @@
|
||||
# doc : https://nginx.org/en/docs/dirindex.html
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
location / { root /data/www; }
|
||||
location /images/ { root /data; }
|
||||
server_name hulamy.42.fr;
|
||||
root /data/www/;
|
||||
|
||||
# switch between two following tests configurations
|
||||
location / { try_files $uri /index.html; } # try files then redirect to index.html (https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files)
|
||||
# return 301 https://$host$request_uri; # redirect on https
|
||||
}
|
||||
|
||||
#server {
|
||||
# listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||
# listen [::]:443 ssl; # for ipv6
|
||||
# server_name hulamy.42.fr;
|
||||
# ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt # specifies the file with the ssl certificate (self signed here) generated by openssl
|
||||
# ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key # specifies the file with the secret key of the certificate
|
||||
#
|
||||
# root /var/www/html; # contains default nginx index.nginx-debian.html
|
||||
# index index.html index.htm index.nginx-debian.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
|
||||
#
|
||||
# location / {
|
||||
# try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
|
||||
# # test
|
||||
# root /data/www;
|
||||
# }
|
||||
#}
|
||||
server {
|
||||
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||
listen [::]:443 ssl; # for ipv6
|
||||
server_name hulamy.42.fr;
|
||||
ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
|
||||
ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key; # specifies the file with the secret key of the certificate
|
||||
|
||||
root /var/www/html/; # contains default nginx index.nginx-debian.html
|
||||
index index.html index.htm index.nginx-debian.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
|
||||
# for test
|
||||
root /data/wwws/;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
you are on http connection, on port 80, on localhost
|
||||
you are on http connection, there is nothing for you there, you should go to https
|
||||
|
||||
Reference in New Issue
Block a user