Hi,
I have a setup where there are 2 installations of wordpress .One under /
and one under /wordpress . The configs are as below
##############################
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /wordpress {
try_files $uri $uri/ /wordpress/index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/opt/pifpm/fpmsockets/picdn.sock;
fastcgi_index index.php;
include fastcgi_params;
}
######################
The problem is that URL's like http://picdn.com/2013/01/hello-world/
work ;
but not http://picdn.com/wordpress/2013/01/04/hello-world/
The second URL simply redirects to http://picdn.com/2013/01/hello-world/
Here is what the nginx log show
============================================
122.164.61.17 - - [04/Jan/2013:08:14:22 -0500] "GET
/wordpress/2013/01/04/hello-world/ HTTP/1.1" 301 5 "
http://picdn.com/wordpress/" "Mozilla/5.0 (X11; Linux i686)
AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97
Safari/537.11"
122.164.61.17 - - [04/Jan/2013:08:14:22 -0500] "GET
/2013/01/hello-world/
HTTP/1.1" 200 3764 "http://picdn.com/wordpress/" "Mozilla/5.0 (X11;
Linux
i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97
Safari/537.11"
===========================================
Any idea why this might be happening?
Thanks in advance,
on 2013-01-04 14:17
on 2013-01-04 14:26
On Fri, Jan 4, 2013 at 8:16 PM, Anoop Alias <anoopalias01@gmail.com> wrote: > > fastcgi_pass unix:/opt/pifpm/fpmsockets/picdn.sock; > fastcgi_index index.php; > include fastcgi_params; > } > > I think you forgot this line fastcgi_param SCRIPT_FILENAME $request_filename;
on 2013-01-04 14:30
On Fri, Jan 4, 2013 at 6:55 PM, Edho Arief <edho@myconan.net> wrote: > > location / { > > > > fastcgi_param SCRIPT_FILENAME $request_filename; > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > In my fastcgi_params include file I have ========== fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; ========== Will this not work? Thanks
on 2013-01-04 14:36
On Fri, Jan 4, 2013 at 8:29 PM, Anoop Alias <anoopalias01@gmail.com> wrote: > > fastcgi_param DOCUMENT_ROOT $document_root; > > fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; > ========== > > Will this not work? > My last test few years ago showed $request_filename worked much better. May or may not matter now, though. Still worth a try, I'd say.
on 2013-01-04 14:44
On Fri, Jan 4, 2013 at 7:05 PM, Edho Arief <edho@myconan.net> wrote: > > My last test few years ago showed $request_filename worked much > better. May or may not matter now, though. Still worth a try, I'd say. > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > Edho ..that worked .Thanks But curious to know whats the difference between ===== #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; ====== If I had set a root /home/picdn/public_html/wordpress; inside the location /wordpress ..it would have worked ?. Whats the best route to take here as I see many docs doing it differently . Thanks,
on 2013-01-04 14:51
On Fri, Jan 4, 2013 at 8:43 PM, Anoop Alias <anoopalias01@gmail.com>
wrote:
>
my wild guess says the $fastcgi_script_name doesn't get passed
correctly (or in unexpected way, e.g. blank) when using try_files
causing it to use default /index.php.
on 2013-01-04 15:13
On Fri, Jan 4, 2013 at 7:20 PM, Edho Arief <edho@myconan.net> wrote: > #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; > > fastcgi_param SCRIPT_FILENAME $request_filename; > Actually i guess it was a caching issue with my browser when i was using a different try_files line fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; Both works now .. Thanks,
on 2013-01-04 15:15
On Fri, Jan 4, 2013 at 9:12 PM, Anoop Alias <anoopalias01@gmail.com> wrote: > > fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; > fastcgi_param SCRIPT_FILENAME $request_filename; > > > Both works now .. > Yeah, I don't see difference with either setting. Though I'd say you forgot to actually reload the config after adding the subdirectory config since I also got redirect on the subdirectory url.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.