From 5afd237bbd22028b85532b8c0b3fcead49a00764 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 9 Jan 2020 18:38:59 +0100 Subject: SSL and cleaner Dockerfile with setup scripts --- srcs/nginx_conf/ft_server.com | 41 +++++++++++++++++++++++++++++++++++++++++ srcs/nginx_conf/test.com | 30 ------------------------------ 2 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 srcs/nginx_conf/ft_server.com delete mode 100644 srcs/nginx_conf/test.com (limited to 'srcs/nginx_conf') diff --git a/srcs/nginx_conf/ft_server.com b/srcs/nginx_conf/ft_server.com new file mode 100644 index 0000000..b04e470 --- /dev/null +++ b/srcs/nginx_conf/ft_server.com @@ -0,0 +1,41 @@ +server { + listen 443 ssl; + listen [::]:443 ssl; + + ssl_certificate /root/ssl/localhost.pem; + ssl_certificate_key /root/ssl/localhost-key.pem; + + server_name localhost; + index index.php; + root /var/www/wordpress; + + location / { + try_files $uri $uri/ =404; # if uri or uri/ not valid, 404 error + } + + # phpmyadmin path, change root + location /phpmyadmin { + root /var/www; + index index.php; + location ~ ^/phpmyadmin/(.+\.php)$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; + } + location ~ ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { + root /var/www; + } + } + + # php files + location ~ \.php$ { + include snippets/fastcgi-php.conf; # include php fpm settings + fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # socket where php fpm is running + } +} + +server { + listen 80; + listen [::]:80; + server_name localhost; + return 301 https://$host$request_uri; +} diff --git a/srcs/nginx_conf/test.com b/srcs/nginx_conf/test.com deleted file mode 100644 index b9d9de2..0000000 --- a/srcs/nginx_conf/test.com +++ /dev/null @@ -1,30 +0,0 @@ -server { - listen 80; - server_name localhost; - index index.php; - root /var/www/wordpress; - - location / { - try_files $uri $uri/ =404; # if uri or uri/ not valid, 404 error - } - - # phpmyadmin path, change root - location /phpmyadmin { - root /var/www; - index index.php; - location ~ ^/phpmyadmin/(.+\.php)$ { - include snippets/fastcgi-php.conf; - fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; - } - location ~ ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { - root /var/www; - } - } - - # php files - location ~ \.php$ { - include snippets/fastcgi-php.conf; # include php fpm settings - fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # socket where php fpm is running - } -} - -- cgit