502 Bad Gateway, I messed up users and groups permissions on digitalocean ubuntu for django deployment
I guess that the problem is that by running sudo chmod -R 760 /var/www/
you have forbidden non-ownesrs of the folder to read, write and execute files form that directory. Then, since uwsgi processes does not belong to the www-data group (usually), uwsgi connection was refused.
The easiest way to solve this problem is to run sudo chmod -R 766 /var/www/
- this will grant writing and readind priveleges to anyone (chmod -R 764
should also work and is safer - it allows only reading files for non-owners). Alternatively, you may find out the name of the user running uwsgi and grant him permissions for reading files form the directory. See chmod
manual (or google it) for reference.
Unable to access my website using the IP address of my Digital Ocean droplet
You are missing the Nginx. Port 80 is open but you are trying 5000, so won't work.
You can open port 5000 in the firewall and also check ufw firewall.
ufw status
and open the port using command
sudo ufw allow 5000
After setting up server blocks, Nginx is not serving my domain name
1. chmod 777
is NEVER a good idea.
NGINX operats under a runuser. How to check the runuser:
ps -elf |grep nginx
. Normaly it will be nginx
. Instead of 777
(Open for everyone) do chmod -R 755 /path/to/folder
and chown -R nginx:nginx /path/to/folder
But agree. For troubleshooting it can be used. But back to your problem.
2. Directory-Listing disabled.
The error is telling you nginx can not list the directory content. Which is the default behavior. Make sure
root /var/www/sundaray.io/html;
This path exists AND
index index.html index.htm index.nginx-debian.html;
there are one of these files located!
Without any of these files NGINX can't load the default index file on /
. Put something in /var/www/sundaray.io/html
like
printf "<html>\n<body>\n<h1>Hello from NGINX</h1>\n</body>\n</html>" > /var/www/sundaray.io/html/index.html && chown nginx:nginx /var/www/sundaray.io/html/index.html
. This should generate an index.html for you.
If you just want to test your server configuration without any files:
location / {
return 200 "Hello on $host$uri\n";
}
Why, I can't update my react app hosted on Digital Ocean?
Have you tried to clean the cache from your local browser?
If you do not want to clean local browser cache, open a new browser in incognito mode.
For debugging without risk of cache local, i would recommend open a browser in developer console (F12), change to tab network and click button disable cache
.
The disable cache
option is only active if developer console is open.
502 Bad Gateway when installing PHP7.2 on nginx
I had same problem, so I changed the nginx config file /etc/nginx/sites-avaiable/your-site
.
Change:
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
to
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
This worked for me.
PM2 and Nginx: 502 Bad Gateway
I just had to start PM2 with bin/www instead of app.js. Express generator and everything...
Related Topics
Stop Being Root in the Middle of a Script That Was Run with Sudo
Replace Bash Variables in Template File
Usb Modem Is Echoing Back Wrong Characters
Multiple -A with Greater Than/Less Than Break Bash Script
Overhead of Supporting Floating Point Arithmetic Inside the Linux Kernel
How to Make a Bash String of Command with Redirect and Pipe
Are the 'Dot' and 'Dot Dot' Files in Unix and Linux Real Files
Bash Script Properties File Using '.' in Variable Name
How to Make Linux Power Off When Halt Is Run
Cmsg_Nxthdr() Returns Null Even Though There Are More Cmsghdr Objects
How to Suspend and Resume a Sequence of Commands in Bash
Gatttool Non-Interactive Mode --Char-Write
Differentiate Between Exit and Session Timeout
Django on Apache Wtih Mod_Wsgi (Linux) - 403 Forbidden
How to Install Rpy2 via Conda Using Default R Installation
Call Printf System Subroutine to Output a Integer Number Error in Assembly Code