I have nginx and php-fpm and php installed on my device. I'm trying to configure nginx to work correctly. I've read viewtopic.php?t=5024 and https://wiki.archlinux.org/index.php/nginx and I still have problems.
Essentially, nginx will correctly return index.php with phpinfo() output in it. However, if I have an exact copy of the file, but name it test.php, I get served up a text file with <?php phpinfo(); ?> in it.
So something's going on with nginx where it's not recognizing anything but $root/index.php as a PHP file to invoke PHP for.
What might be the problem?
Here's nginx.conf:
$this->bbcode_second_pass_code('', '#user http;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
keepalive_timeout 15;
gzip on;
gzip_comp_level 1;
server {
listen 80;
server_name localhost;
location ~ \.php {
root /srv/http;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
root /srv/http;
index index.php;
try_files $uri $uri/ /index.php;
}
}
}
')
