I ran chown -R www-data:www-data /var/www and got 500 Internal Server Error, get a file not found error on all of my domains and can’t seem to fix it.
I feel like it used the wrong path since everything is there but I’m not positive.
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
Got it! It had changed the permission of the folder /var/www and the ownership of vhost files and folders also. Thanks folks!
I know you’ve got plesk, can you restart it or Restart nginx. Every time i’ve had this happen it’s due to a change i’ve made in the
/etc/nginx/nginx.confor any .conf in
/etc/nginxor even other changes. When battling 500’s likely due to server nginx always Restart nginx after each change, if possible which with D.O. certainly should be.
I think it’s
systemctl service stop nginxdepending on the distro and version. and then
systemctl service start nginx(maybe even restart in some instances, and other instances it’s like a “?” service.nginx restart command. You’ll have to browse the googles for them, there’s a few. Or if you used homebrew for linux or are locally on mac it would be something like
brew service nginx restart
NOTE: I could have butchered these commands i’m writing mobile off the top My apologies to others, you perfect code monks and Heads of the Board of Forum Board Educators, Etiquette, and Format :)
The other matter I’ve found myself failing at often was php-fpm in my nginx configuration. I had a local version running php7.2-fpm on a @php7.4fpm version. Make sure your path mentioned in your sites-available match up. Thirdly, create a new folder as user sudo mkdir in sites-enabled and this actually helped in one case where I opted not to use the default that was set up and just matched all files up correctly. In my case it was laravel on Ubuntu. Today, it still is so if you chaps have any input on my soon to be thread i’d appreciate any input.
Also if you use git at all you may be using root on a VPS any change you make might undo your work by changing user/group perms back to root.
My one, two, or maybe 3 cents more than anyone wanted on this matter but maybe will keep the next “me” who’s browsing similar topics to see this and say hey I know that, and “no, I dont need to restart nginx, it’s fine.” then suddenly they see this where I had previously thought that exact thing, Boom resolution along with the items listed above.
Starting a new reply as the other was maxed out.
Now that I can see the “File Not Found” using the IP address, that’s most likely an issue with NGINX, not Apache and also an issue with permissions. I’ve seen the same error on proxy setups with NGINX before and it falls back on PHP-FPM in most cases.
So if you have NGINX in front of Apache and setup as a proxy (NGINX on Port 80/443, Apache on Port 7080, etc), then I’d take a look at your PHP-FPM configuration and if possible, post that as well.
Specifically, we’d need to look at the location block that handles PHP connections for NGINX.