Reputation: 193
I'm trying to setup Nginx on my new Raspberry Pi and I'm having some problems with getting PHP to work. The problem is that the browser wants to download the file instead of executing it :( Also, when I do this with curl (a tool I just found out about, btw): curl localhost:9000/test.php I get "curl: (7) couldn't connect to host". I've rewritten my server config file MANY times now and I feel that it's time to just ask someone for help :)
Upvotes: 0
Views: 2824
Reputation: 193
Solved it finally! Can't even remember when I started with this :s
Anyways, there was another problem altogether that I wasn't aware of to begin with; under /etc/nginx/conf.d there's a default config file, default.conf, this file was overwriting everything I tried to do with localhost in my sites-enabled folder and after discovering this by chance, I was able to get it to work after some small adjustments.
Upvotes: -1
Reputation: 159
Most likely your PHP script does not set a content MIME type and therefore the default_type directive is used. Check your config for default_type application/octet-stream
and change it to default_type text/html
or make sure your PHP returns a proper content MIME type.
Upvotes: 3