Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
“Uncomment the correct lines in “location ~ .php$ {“ section” —
Can you Give little eloboration on this. What settings needs to uncomment. I am getting. 502 bat gateway error. whil accessing a PHP page.
Thanks in advance
Hello,
I configured my servet just like this but my server is not behaving as expected when I try to access a URL that doesn’t exist.
If I try to access http://myserver/3i1idaosdj (a file that does not exist), I get a 500 Internal Server Error.
If I try to access http://myserver/3i1idaosdj.php (a file that does not exist and the URL ends with .php), I get a message saying “No input file specified”.
Accessing the error log, I got the following message:
2012/08/08 03:18:45 [error] 6699#0: *1 rewrite or internal redirection cycle while internally redirecting to “/index.html”, client: my ip, server: localhost, request: “GET /3i1idaosdj HTTP/1.1”, host: “my server ip”
Also, I configured the 404 error page in /etc/nginx/sites-available/default, via:
error_page 404 /404.html;
And 404.html is properly placed in the website folder. Why this is not working?
In the nginx config make sure you updated: server_name example.com;
And replaced example.com with your actual domain name and then test it through the web.
If you just have an IP and not a domain name you can use that as well.
If you’re still having a problem paste us your nginx config and we can help go through it.
Thanks
You have a small typo near the end :
location ~ /.ht { deny all; } }
It should be:
location ~ /.ht/ { deny all; } }
However, this wouldnt be the cause for the issues you were having. I did test the URL via the IP for both a non-existent file, received the 404, and a non-existent file ending in .php and got good 404 errors for both.
Visiting the IP directly I did get the phpinfo() page, I’m assuming you made an index.php?
If that’s the case I don’t really see what issue you are having unless you are uploading php files and they aren’t displaying or if you are uploading static content and having an issue.
What URL are you hitting that you should see something and you dont? And can you show me the file listing in: /srv/www/test/
Thanks.
raiyu, thanks for the help, I solved the problem today, that’s why you got the 404 working.
Here is my modified /etc/nginx/sites-available/default code. Hope it helps in case that someone have the same issue:
Hello. Your tutorial is good. I want to change the current document root directory to “home/user101/box/devs” How can I do that? I’m new to Nginx. Thanks and more power!
Inside the server { } directive there is a root directive that which specifies where to serve files from:
server { root /home/user101/box/devs; }