0

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 :)

2 Answers 2

3

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.

0
-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.