[wgo2-web/oscp] Separate gnome.org vhost and add /news redirect



commit 54fcb2390469ba916e30e950d0a9825b3c3006a2
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Mar 29 10:54:59 2021 +0200

    Separate gnome.org vhost and add /news redirect

 nginx.conf | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 84 insertions(+), 2 deletions(-)
---
diff --git a/nginx.conf b/nginx.conf
index 2fa635b..bb19695 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -64,8 +64,10 @@ http {
     access_log  /dev/stdout  main;
 
     server {
-        listen 8080 default_server;
-        listen [::]:8080 default_server;
+        listen 8080;
+        listen [::]:8080;
+       
+        server_name www.gnome.org;
         
         error_log /dev/stderr;
         
@@ -83,6 +85,8 @@ http {
            try_files $uri $uri/ /index.php?$args;
         }
 
+        rewrite ^/news/(.+) https://foundation.gnome.org/news/$1 permanent;
+
         rewrite ^/foundation/charter.html https://wiki.gnome.org/Foundation/Charter permanent;
         rewrite ^/foundation/membership/members.php /foundation/membership permanent;
         rewrite ^/vote https://vote.gnome.org permanent;
@@ -195,4 +199,82 @@ http {
             deny all;
         }
     }
+
+    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]