nginx serves info.php but doesn't serve index.php [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












info.php with basic phpinfo() is served when I enter info.php in the url, however index.php is not being served. I tweaked around some changes reading different answers on stackexchange:



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


and



`try_files $uri $uri/ /index.php;`


and



`try_files $uri $uri/ /index.php?q=$uri`


but nothing seems to work; there is nothing in the error log or php5-fpm.log.
Here is my entry in sites-enabled:



server 
listen 80;
server_name demo.demo;
root /demo.demo.us/;
index index.php index.html;
rewrite_log on;
location /
index index.php index.html;
rewrite ^/$ /index.php last;

location ~ .php$
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;




no index.php or index.html file is served, but both html and php files are served when specific requests are made; demo.demo/info.php works correctly but demo.demo shows a blank page only.
As php works when specifically requested, I am guessing it is rewrite issue.
What is configured incorrectly?










share|improve this question















closed as off-topic by Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel Sep 22 at 6:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel
If this question can be reworded to fit the rules in the help center, please edit the question.












  • is there something in your nginx logs?
    – taliezin
    Mar 17 '15 at 15:12










  • access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
    – Faruq Ahmad
    Mar 17 '15 at 15:44










  • it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
    – taliezin
    Mar 17 '15 at 16:26










  • thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
    – Faruq Ahmad
    Mar 17 '15 at 17:48










  • funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
    – Faruq Ahmad
    Mar 17 '15 at 17:51















up vote
1
down vote

favorite












info.php with basic phpinfo() is served when I enter info.php in the url, however index.php is not being served. I tweaked around some changes reading different answers on stackexchange:



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


and



`try_files $uri $uri/ /index.php;`


and



`try_files $uri $uri/ /index.php?q=$uri`


but nothing seems to work; there is nothing in the error log or php5-fpm.log.
Here is my entry in sites-enabled:



server 
listen 80;
server_name demo.demo;
root /demo.demo.us/;
index index.php index.html;
rewrite_log on;
location /
index index.php index.html;
rewrite ^/$ /index.php last;

location ~ .php$
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;




no index.php or index.html file is served, but both html and php files are served when specific requests are made; demo.demo/info.php works correctly but demo.demo shows a blank page only.
As php works when specifically requested, I am guessing it is rewrite issue.
What is configured incorrectly?










share|improve this question















closed as off-topic by Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel Sep 22 at 6:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel
If this question can be reworded to fit the rules in the help center, please edit the question.












  • is there something in your nginx logs?
    – taliezin
    Mar 17 '15 at 15:12










  • access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
    – Faruq Ahmad
    Mar 17 '15 at 15:44










  • it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
    – taliezin
    Mar 17 '15 at 16:26










  • thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
    – Faruq Ahmad
    Mar 17 '15 at 17:48










  • funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
    – Faruq Ahmad
    Mar 17 '15 at 17:51













up vote
1
down vote

favorite









up vote
1
down vote

favorite











info.php with basic phpinfo() is served when I enter info.php in the url, however index.php is not being served. I tweaked around some changes reading different answers on stackexchange:



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


and



`try_files $uri $uri/ /index.php;`


and



`try_files $uri $uri/ /index.php?q=$uri`


but nothing seems to work; there is nothing in the error log or php5-fpm.log.
Here is my entry in sites-enabled:



server 
listen 80;
server_name demo.demo;
root /demo.demo.us/;
index index.php index.html;
rewrite_log on;
location /
index index.php index.html;
rewrite ^/$ /index.php last;

location ~ .php$
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;




no index.php or index.html file is served, but both html and php files are served when specific requests are made; demo.demo/info.php works correctly but demo.demo shows a blank page only.
As php works when specifically requested, I am guessing it is rewrite issue.
What is configured incorrectly?










share|improve this question















info.php with basic phpinfo() is served when I enter info.php in the url, however index.php is not being served. I tweaked around some changes reading different answers on stackexchange:



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


and



`try_files $uri $uri/ /index.php;`


and



`try_files $uri $uri/ /index.php?q=$uri`


but nothing seems to work; there is nothing in the error log or php5-fpm.log.
Here is my entry in sites-enabled:



server 
listen 80;
server_name demo.demo;
root /demo.demo.us/;
index index.php index.html;
rewrite_log on;
location /
index index.php index.html;
rewrite ^/$ /index.php last;

location ~ .php$
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;




no index.php or index.html file is served, but both html and php files are served when specific requests are made; demo.demo/info.php works correctly but demo.demo shows a blank page only.
As php works when specifically requested, I am guessing it is rewrite issue.
What is configured incorrectly?







configuration php nginx rewrite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 19 at 10:49









Jeff Schaller

33.2k849111




33.2k849111










asked Mar 17 '15 at 13:46









Faruq Ahmad

62




62




closed as off-topic by Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel Sep 22 at 6:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel Sep 22 at 6:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Kiwy, sebasth, Thomas, Volker Siegel
If this question can be reworded to fit the rules in the help center, please edit the question.











  • is there something in your nginx logs?
    – taliezin
    Mar 17 '15 at 15:12










  • access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
    – Faruq Ahmad
    Mar 17 '15 at 15:44










  • it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
    – taliezin
    Mar 17 '15 at 16:26










  • thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
    – Faruq Ahmad
    Mar 17 '15 at 17:48










  • funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
    – Faruq Ahmad
    Mar 17 '15 at 17:51

















  • is there something in your nginx logs?
    – taliezin
    Mar 17 '15 at 15:12










  • access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
    – Faruq Ahmad
    Mar 17 '15 at 15:44










  • it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
    – taliezin
    Mar 17 '15 at 16:26










  • thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
    – Faruq Ahmad
    Mar 17 '15 at 17:48










  • funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
    – Faruq Ahmad
    Mar 17 '15 at 17:51
















is there something in your nginx logs?
– taliezin
Mar 17 '15 at 15:12




is there something in your nginx logs?
– taliezin
Mar 17 '15 at 15:12












access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
– Faruq Ahmad
Mar 17 '15 at 15:44




access log shows that a page is accessed. 39.59.122.46 - - [17/Mar/2015:15:09:13 +0000] "GET /phpinfo.php HTTP/1.1" 200 9035 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" nothing in the error log.
– Faruq Ahmad
Mar 17 '15 at 15:44












it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
– taliezin
Mar 17 '15 at 16:26




it is difficult to say, but move index index.php index.html; outside the location and comment the second, just put there: try_files $uri $uri/ /index.php; By convention is not good index line to be in location although I don't know if this is the problem.
– taliezin
Mar 17 '15 at 16:26












thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
– Faruq Ahmad
Mar 17 '15 at 17:48




thnx, but it's not the problem,. I removed everything started from basic listen, name and php location block, tried almost everything with index, rewrite and try_files inside and outside location/ as well as location php block, just index, just try_files, just rewrite, and their combinations as many as I could make. also tried with root inside the location/ and location php block. If location/ is removed and index is in location php block, I get access denied, in which case I get an error in error log saying it doesnt exist. tried working around it using security_limitations but to no avail.
– Faruq Ahmad
Mar 17 '15 at 17:48












funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
– Faruq Ahmad
Mar 17 '15 at 17:51





funnily enough info.php is served whenever requested, no matter the position of root, index or rewrite in the file as long as there is a location php block in the file, and any other static html page or any other php script is also answered when requested in url. that brings me back to rewrite which apache does almost on its own, never had to struggle with this.
– Faruq Ahmad
Mar 17 '15 at 17:51
















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay