Default NGINX Page
I have installed NGINX on CentOS 5.x and its working smooth. However if I access mydomain.com in the browser, it throws a 404 error.
What I need to accomplish is :
1) If I access mydomain.com , it should fetch for a default index.php or index.html in the directory allocated(root directory) for that domain and display the same. If there is no such file, then it should display a default custom page(i.e a Welcome Page).
2) If I access mydomain.com/test.php and if test.php is not found only then it should display the 404 error page.
3) Also, I want a common error handler for all the server blocks created(for each domains).
I need the configurations for the same. Any help is greatly appreciated.
Just an initial thought, I'm sure you know nginx will not do a great deal with a php file on its own, unless you've set up eg FastCGI somewhere for nginx to connect to.
Out of interest, what brought you to choose nginx over, say, Apache? It's not to say it's a great tool, it just sounds like messing with configs (ie to say, getting others to write them for you) might not be quite what you're looking for at the moment. Regardless...
For 1) I would set up a server block which catches all, sticks it in a regex and looks for the site directory:
3) For all server blocks/for each domain - rather ambiguous - are you wanting to serve up exactly the same error page across all domains? If so take a look at error_page in nginx wiki, there are a couple of solutions you could use.
Thanks a lot.. It helped me a lot.
I have the same problem. Can you please tell me in details what you have done step by step? Which files you edited and where they are located? Thanks
|All times are GMT -5. The time now is 03:40 AM.|