Welcome! Log In Create A New Profile


Cannot get multiple sections (apps) to work properly

Posted by DisgruntledGoat 
Cannot get multiple sections (apps) to work properly
July 15, 2013 08:27AM
Hi, I've been struggling with this issue for ages now. Feel like I've read every page of the docs 100 times!

I have a site running on nginx, there are two basic sections. First is a database-driven website (PHP/MySQL) using CodeIgniter. This is all working fine. Second is a Q&A forum running on Question2Answer (question2answer.org), in a subfolder /qa/. My original config is like this (inside the server block):

index index.php index.html;

# Q2A
if ($request_uri ~* "^/qa/") {
rewrite ^/qa/(.*)$ /qa/index.php?qa-rewrite=$1 last;

# CI
location / {
try_files $uri /index.php?$request_uri;

location ~ \.php$ {
try_files $uri =404;

include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/mysite$fastcgi_script_name;
fastcgi_param HTTPS off;

(Sorry can't find how to do code formatting.)

The main problem is that static files (JSS, CSS, images) inside the /qa/ folder are not being served, the URLs are being passed to the Q2A app (where I get "page not found"). I've tried all sorts of permutations but nothing that works properly. For example if I do this, the index.php file gets served up for download!

location ~ /qa/(.*)? {
try_files $uri /qa/index.php?qa-rewrite=$1;

Apparently doing `if (!-e $request_filename) {}` is a really bad idea too.

Does anyone know how to get this working?!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready