Nginx is giving me a 500 error that’s driving me crazy. First of all I have a personalsite.conf archive inside /etc/nginx/conf.d/ where I have my server block.
This is my server block configuration:
server {
listen 80;
server_name personalsite.me;
charset UTF-8;
access_log /var/log/nginx/personalsite.access.log main;
error_log /var/log/nginx/personalsite.error.log;
root /usr/share/nginx/html/personalsite;
index index.php index.html index.htm;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Plus nginx user have its proper permissions asigned over /usr/share/nginx/html/personalsite/.
The thing is Nginx is giving me a 500 error when I try to browse personalsite.me, and the funny thing is that I know that because I checked the personalsite.access.log and see it, because the brower just goes blank. By unknown reasons Nginx is unable to show me its 500 error page, properly declared in the server block as you can see.
Another odd thing is that personalsite.error.log is in blank, it records nothing.
Also I have that domain declared with its IP in my /etc/hosts archive. So I really have no idea what’s happening here.
Everything is running CentOS 7 over a droplet here in Digital Ocean.
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!
SELinux stopped it working for me. Guess I hadn’t rebooted the machine since I installed.
This question was answered by @EpicCDN:
Try to check /var/log/nginx/error.log if exist, if not, remove the line where you are assigning a diferent log file so he uses the standard one at /var/log/nginx/error.log
Also the socket thing is a recommendation and some people can recommend you to use tcp, but still should not be related to your error if you phpinfo.php is working.
Does this Yii requires any kind of cute urls or something similar?
try adding " fastcgi_intercept_errors on; " to the php block and check error log.
First check that your error logging configuration is working as expected. PHP can be set to show errors on the page itself or to save them in an error log of sorts. You can use <?php phpinfo(); ?> to display the settings, look display_errors (to see if it’s supposed to show them on the page), error_log (to see where it saves them), log_error (if it logs them at all!), and error_reporting (which errors does it report). error_reporting is a number, you can use this tool to see what it means.
If everything is fine with your error reporting setup then the next step is maybe there is something in your code inhibiting errors. In particular the evil ‘@’ operator which causes errors to disappear for a specific line, which would make your app fail silently.
As a last resort you can experiment with putting trigger_error() or even print() in various places in your code to try to pinpoint where the app is failing.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.