[wgo2-web/oscp] Install nginx into the image
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [wgo2-web/oscp] Install nginx into the image
- Date: Thu, 4 Mar 2021 10:01:49 +0000 (UTC)
commit 01041e70093c1e04c60142cec100029d485c63ef
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Thu Mar 4 11:00:29 2021 +0100
Install nginx into the image
Dockerfile | 7 +++-
nginx.conf | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 136 insertions(+), 2 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index 7f6b6a9..3e51f66 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,10 @@
FROM wordpress:fpm
-SHELL ["/bin/bash", "-c"]
-
+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
+
RUN apt-get update && apt-get install -y libldap-2.4-2 libldap2-dev && \
docker-php-ext-configure ldap && \
docker-php-ext-install -j$(nproc) ldap
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..288614a
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,131 @@
+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;
+
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ keepalive_timeout 65;
+
+ gzip on;
+ gzip_vary on;
+ gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript
application/x-javascript;
+
+ upstream php-fpm {
+ server localhost:9000;
+ }
+
+ map $uri $blogname {
+ ~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath;
+ }
+
+ map $blogname $tmp_blogid {
+ default -999;
+ include /var/www/html/wp-content/uploads/nginx-helper/map.conf;
+ }
+
+ map $http_host $blogid {
+ default $tmp_blogid;
+ include /var/www/html/wp-content/uploads/nginx-helper/map.conf;
+ }
+
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for" "$http_host" '
+ '"$blogid"';
+ access_log /dev/stdout main;
+
+ server {
+ listen 8080 default_server;
+ listen [::]:8080 default_server;
+
+ error_log /dev/stderr;
+
+ absolute_redirect off;
+
+ root /var/www/html;
+ index index.php;
+
+ client_max_body_size 100M;
+
+ location = /favicon.ico {
+ log_not_found off;
+ access_log off;
+ }
+
+ location = /robots.txt {
+ allow all;
+ log_not_found off;
+ access_log off;
+ }
+
+ location = /xmlrpc.php {
+ deny all;
+ access_log off;
+ log_not_found off;
+ return 444;
+ }
+
+ location ~ ^(/[^/]+/)?files/(.+) {
+ try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
+ expires max;
+ access_log off;
+ log_not_found off;
+ }
+
+ location ~ ^/files/(.*)$ {
+ try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
+ expires max;
+ access_log off;
+ log_not_found off;
+ }
+
+ if (!-e $request_filename) {
+ rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
+ rewrite ^(/[^/]+)?(/wp-.*) $2 last;
+ rewrite ^(/[^/]+)?(/.*\.php) $2 last;
+ }
+
+ # avoid php readfile()
+ location ^~ /blogs.dir {
+ internal;
+ alias /var/www/html/wp-content/blogs.dir;
+ access_log off;
+ log_not_found off;
+ expires max;
+ }
+
+ location / {
+ try_files $uri $uri/ /index.php?$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]