From e1ad4bff3a2e71b0d41f30bbeb3cc6be1afcb53c Mon Sep 17 00:00:00 2001
From: peter_rabbit <pierrejarriges@gmail.com>
Date: Mon, 18 Jan 2021 15:26:48 +0100
Subject: [PATCH] nginx conf file

---
 .htaccess  |  7 -------
 Dockerfile |  7 ++++---
 Makefile   |  2 +-
 nginx.conf | 39 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 11 deletions(-)
 delete mode 100644 .htaccess
 create mode 100644 nginx.conf

diff --git a/.htaccess b/.htaccess
deleted file mode 100644
index daf81ff..0000000
--- a/.htaccess
+++ /dev/null
@@ -1,7 +0,0 @@
-RewriteEngine On
-RewriteBase /My-Project/
-
-RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
-RewriteRule ^ %1 [L,NE,R=302]
-
-RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 9c08500..af42a87 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,9 +5,10 @@ RUN rm -rf /usr/share/nginx/html/*
 
 RUN apt-get update \
     && apt upgrade -y \
-    && apt-get install nodejs npm -y \
-    && npm install
+    && apt-get install nodejs npm -y
 
 WORKDIR /usr/share/nginx/html
 
-COPY . .
\ No newline at end of file
+COPY . .
+
+RUN cp .nginx.conf /etc/nginx/nginx.conf
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 45327c2..ac2f435 100644
--- a/Makefile
+++ b/Makefile
@@ -24,4 +24,4 @@ stylesheet:
 	docker exec -it kuadrado bash -c "npm run style"
 
 open:
-	firefox http://localhost/public/
+	firefox http://localhost/
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..886be57
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,39 @@
+user  nginx;
+worker_processes  1;
+
+error_log  /var/log/nginx/error.log warn;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    #gzip  on;
+	
+    include /etc/nginx/conf.d/*.conf;
+
+	server {
+        listen 80;
+        root /public;
+		location / {
+			root /public;
+		}
+	}
+}
+
-- 
GitLab