Apache behind nginx + pretty urls

Fórumok

Sziasztok,

Futtatok apache-on[port 8080] egy mediawiki szervert, amit egy nginx[port 80] proxy kuld hatra az indiannak.

A setup a kovetkezo
apache2 root dir: /var/www/html
mediawiki dir: /var/www/html/wiki

Az NGINX az alap webszerverem minden alkalmazashoz, de a mediawiki dokumentaciobol ugy vettem ki, hogy az apache-ot kedveli igazan es ahhoz is van a tobb leiras.
Ennek dacara nem sikerul megoldanom egy szitut, ami remelem csak user error es nem a proxy miatt hasal el.

Adott egy internal url: http://tools.cegem.com
wiki: tools.cegem.com/wiki --nginx proxy--> http://tools.cegem.com/wiki/index.php/Main_Page

Az apache a default beallitasokkal ketyeg:


<VirtualHost *:8080>

ServerAdmin admin@cegem.com
DocumentRoot /var/www/html


ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Az NGINX pedig a kovetkezo (reszlet):


server {
   listen 80;
   server_name tools.cegem.com;

   [...]

    location /wiki {
    client_max_body_size 150M;
    proxy_set_header Connection "";
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Frame-Options SAMEORIGIN;
    proxy_buffers 256 16k;
    proxy_buffer_size 16k;
    proxy_read_timeout 600s;
    proxy_cache_revalidate on;
    proxy_cache_min_uses 2;
    proxy_cache_use_stale timeout;
    proxy_cache_lock on;
    proxy_pass http://wiki;
   }

   location @mediawiki {
   rewrite ^/wiki([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
   }
   }

A mediawiki config file idekapcsolodo reszei:


   $wgScriptPath = "/wiki";
   $wgServer = "http://tools.cegem.com";
   $wgResourceBasePath = $wgScriptPath;

A tools.cegem.com/wiki oldal megnyitas utan azonnal atiranyit a http://tools.cegem.com/wiki/index.php/Main_Page
oldalra, amit szeretnek egyel egyszubbe tenni, igy: http://tools.cegem.com/wiki/Main_Page

Logikailag [mivel az nginx csak egy reverse proxy] az apacsban kell egy rewrite rule-t felallitani, de keptelen vagyok osszeszinkronizalni az apache-ot a mediawiki LocalSettings.php file tartalmaval.

Valakinek van tapasztalata a dolgot illetoen, esetleg be tudna forgatni a megoldas iranyaba?

Innen taplalkoztam eddig: https://www.mediawiki.org/wiki/Manual:Short_URL/Apache

Koszi elore is!

Hozzászólások

Az a location minek kell? Ha proxyzol, akkor az nginx ne nyúljon bele semmilyen szinten. Az apache majd megoldja a nice url részt.