I am working on an centos6 with nginx 1.0.6, php 5.3.6, and fpm.
I found that php file in my subdirectory returns a 404,but in nginx home
direcory works fine.
For example , a phpinfo.php file works fine in /data/web/, where
/data/web is my nginx document root. Buy the same file in /data/web/sub,
the browser and nginx both tell a 404 error.
I have similar problem. I can get the index.php to display in the
document root, but when I type www.mydomain.com/administrator it will
not pull the index.php, but if I type www.mydomain.com/administrator/index.php, it will bring the page up. So
is this a configuration file issue or a rewrite issue. I need to resolve
this due to the fact I have some joomla installs that have a root joomla
install and then a subdirectory of joomla installed and I must be able
to get the server to respond to the sub-directory index.php files.
I am new to NGINX and let me say it is awesome, but I still have a lot
to learn.
# It is best to place the root of the server block at the server
level, and not the location level
# any location block path will be relative to this root.
root /home/www/rentavault_net;
# It's always good to set logs, note however you cannot turn off
the error log
# setting error_log off; will simply create a file called
‘off’.
access_log /home/www/rentavault_net/logs/access_log.log main;
error_log /home/www/rentavault_net/logs/error_log.log info;
# This can also go in the http { } level
index index.php index.html;
location / {
# if you're just using wordpress and don't want extra
rewrites
# then replace the word @rewrites with /index.php
try_files $uri $uri/ @rewrites;
}
location ~ ^/cgi-bin/(awredir|awstats).pl {
gzip off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
$document_root/cgi-bin/cgi-bin.php;
fastcgi_param X_SCRIPT_FILENAME
/home/www/rentavault_net/$fastcgi_script_name;
fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
This config will not let me access the sub directory without index.php
in the path of the browser. Very frustrating.
Ok, tried that, I have a suspicion that I may have a load balancer issue
happening as well. Will report back. I was suppose to add fastcgi_index
to the line of
index index.php index.html;
to look like
index fastcgi_index index.php index.html;
Update on my problem… if the URL is typed this way http://www.domain.com/subdirectory it will not pull up the site, but
when the URL is typed http://www.domain.com/subdirectory/ the site comes
up immediately. How to do force nginx to put the trailing slash onto the
subdomains?
I have the same problem with subdirectories. My config Is:
set $sroot /usr/local/www/
location ~ .php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $sroot/$fastcgi_script_name ;
fastcgi_param QUERY_STRING $query_string;
fastcgi_pass 127.0.0.1:9000;
fastcgi_intercept_errors on;
break;
}
location / {
root $sroot ;
index index.php;
}
By the way I think it all happend when I’ve upgraded from nginx 0.9 to
1.0.11. I think that my original configs had been replaced with new
ones.
Update on my problem… if the URL is typed this way http://www.domain.com/subdirectory it will not pull up the site, but
when the URL is typed http://www.domain.com/subdirectory/ the site comes
up immediately. How to do force nginx to put the trailing slash onto the
subdomains?
No, this did not work either.
nginx keeps looking for for relative files in a directory, but
has to do it in /administrator directory
Maybe some other suggestions ?
Edho A. Wrote:
No, this did not work either.
nginx keeps looking for for relative files in a directory, but
has to do it in /administrator directory
Maybe some other suggestions ?
What do you mean? Are the files located in
/services/www/site/administrator/administrator/?
When I login into the index.php which is located in
/services/www/site/administrator
nginx redirects me to index.php which is located in the root directory -
/services/www/site
When I manually enter site.net/administrator/index.php it opens the
right file but all relative links on it (css,js, ,…etc) are being
loaded from root directory (/services/www/site) and thay should be
loaded from subdirectory (/services/www/site/administrator) and that is
why I’m getting many 404 responses from server.
May be but this all started when I’ve updated nginx from 1.0.4 to 1.0.9
This update erased all my previous config files and I’ve started from
beginning
and stuck on this problem
Edho A. Wrote: