[survey-web/oscp] Install nginx



commit fbb16e5cfd62c22c29970faef35482186793d64a
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Dec 29 12:37:01 2020 +0100

    Install nginx

 Dockerfile    |  7 +++--
 entrypoint.sh |  1 -
 nginx.conf    | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 4 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index b094524d..fe6819f4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,9 @@
 FROM martialblog/limesurvey:4-fpm
 
-RUN apt-get update && apt-get install -y rsync
-
-RUN mv /var/www/html /usr/src/limesurvey
+RUN apt-get update && apt-get install -y nginx-light && \
+    ln -sf /dev/stdout /var/log/nginx/access.log && \
+    ln -sf /dev/stderr /var/log/nginx/error.log
+ADD nginx.conf /etc/nginx/nginx.conf
 
 ADD ipa-ca.crt /etc/ipa-ca.crt
 ADD ldap.conf /etc/ldap/ldap.conf
diff --git a/entrypoint.sh b/entrypoint.sh
index dd1d112e..dadf9e4a 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
 
-rsync -r --ignore-existing /usr/src/limesurvey/ /var/www/html
 php application/commands/console.php updatedb
 exec php-fpm
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 00000000..0a604470
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,88 @@
+worker_processes  1;
+
+error_log  /dev/stderr warn;
+pid        /tmp/nginx.pid;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    proxy_temp_path /tmp/proxy_temp;
+    client_body_temp_path /tmp/client_temp;
+    fastcgi_temp_path /tmp/fastcgi_temp;
+    uwsgi_temp_path /tmp/uwsgi_temp;
+    scgi_temp_path /tmp/scgi_temp;
+
+    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  /dev/stdout  main;
+
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    upstream php-fpm {
+        server localhost:9000;
+    }
+
+    server {
+        listen 8080 default_server;
+        listen [::]:8080 default_server;
+        
+        absolute_redirect off;
+        
+        root /var/www/html;
+        index index.php;
+        
+        client_max_body_size 100M;
+
+        location ~ ^/(application|protected|framework|themes/\w+/views) {
+            deny  all;
+        }
+
+        location ~ ^/upload/surveys/.*/fu_[a-z0-9]*$ {
+            return 444;
+        }
+
+        location ~* 
/upload/.*\.(pl|cgi|py|pyc|pyo|phtml|sh|lua|php|php3|php4|php5|php6|pcgi|pcgi3|pcgi4|pcgi5|pcgi6|icn)$ {
+            return 444;
+        }
+
+        location = /favicon.ico {
+                log_not_found off;
+                access_log off;
+        }
+
+        location = /robots.txt {
+                allow all;
+                log_not_found off;
+                access_log off;
+        }
+
+        location / {
+                try_files $uri $uri/ /index.php?r=$uri&$args;
+        }
+
+        location ~ \.php$ {
+                include fastcgi_params;
+                fastcgi_intercept_errors on;
+                fastcgi_read_timeout 300;
+                fastcgi_param  HTTPS 'on';
+                fastcgi_pass php-fpm;
+                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        }
+
+        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
+                expires max;
+                log_not_found off;
+        }
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]