Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
778 views
in Q2A Core by

Hi there 

I created q2a project in subfolder in nginx server

everything works fine for " /?qa=123/why-do-birds-sing URL structure, however it gives 404 for " /index.php/123/why-do-birds-sing 

how fix it in nginx config?

Q2A version: 1.7.4
related to an answer for: how to config nginx on ubuntu for q2a?
by
Whene using this code :
location /bimeh {
index index.php index.html index.htm;
try_files $uri $uri/ /bimeh/index.php?$args;
}
page is ok but css & js get 404 error because get similar link : http://rr.bidbarg.ir/bimeh/index.php/4234/qa-theme/SnowFlat/qa-styles.css?1.7.4

1 Answer

0 votes
by
edited by
server {

    server_name site.com www.site.com;

    root /home/site;

    listen 80;

    index index.html index.htm index.php;

error_log /home/site/error.log error;

set $cache_uri $request_uri;

  location /q {

        index  index.php index.html index.htm;

        if (!-f $request_filename) {

            rewrite ^/q/(.+)?$ /q/index.php?qa-rewrite=$1 last;

        }

    }

location / {

                index index.php index.html index.htm;

                try_files $uri $uri/ /index.php?q=$uri&$args;

        }

        location ~ \.php$ {

            fastcgi_buffers 8 256k;

            fastcgi_buffer_size 128k;

            fastcgi_intercept_errors on;

            include fastcgi_params;

            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

            include snippets/fastcgi-php.conf;

            fastcgi_pass unix:/run/php/php7.2-fpm.sock;

           fastcgi_read_timeout 300;

  if ( -f $request_filename ) {

            fastcgi_pass   unix:/run/php/php7.2-fpm.sock;

        }

        }

                location ~* ^.+\.(rss|atom|jpg|jpeg|gif|png|ico|rtf|js|css|svg)$ {

                expires max;

        }

}
...