I'm new to all things related to webservers. Until now, I used apache. But I want to give a try to nginx. So I decided to install it, alongside PHP. This are the steps I followed (I mention that I use Windows 7):
- download nginx from official website
- download php5.6.11 from official website
- I extracted nginx in C:/ drive
- I extracted and copied php into nginx
I created start.bat file (inside nginx folder), with the following code:
@ECHO OFF start C:\nginx\nginx.exe start C:\nginx\php\php-cgi.exe -b 127.0.0.1:9000 -c C:\nginx\php\php.ini-development ping 127.0.0.1 -n 1>NULL echo Starting nginx echo . echo .. echo ... ping 127.0.0.1 >NUL EXIT
I created stop.bat file (inside nginx folder), with the following code:
@ECHO OFF taskkill /f /IM nginx.exe taskkill /f /IM php-cgi.exe EXIT
I edited nginx/conf/nginx.conf file as follows:
location ~ .php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME C:/nginx/html/$fastcgi_script_name; include fastcgi_params; }
I started nginx, with the help of start.bat
- navigate to 127.0.0.1 in browser, and I got the nginx welcome page.
I created a new php file (test.php) into nginx/html/ directory, with a simple code:
But when I navigate to 127.0.0.1/test.php, it takes a long time to respond (a minute), and after that I got the following error:
------------------------------------------------------
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
Faithfully yours, nginx.
-----------------------------------------------------
If I follow the error log
link, I get this screen:
Any solution? Thank you.