Nginx fails to respond - No errors in log - nginx

Starting about 4 days ago, my Nginx server started to have issues. Around 12:00 every day, the server will suddenly stop responding to requests. The server is configured to serve an Angular app over SSL.
The process will still be active and if I check the error/access logs for the time when it dies there are no fatal errors or anything of that kind, however there will be a blank spot with no access between 12:01 and whenever we noticed and restarted the service. Restarting the service completely fixes the problem.
I've checked the crontab and there is a maintenance route on the API that gets hit right before the crash (runs every hour), but running the scheduled command manually doesn't result in a crash.
I'm at a lost and don't even know where to start looking seeing as I can't replicate the problem.
Syslog at time of failure:
Sep 11 12:02:01 ubuntu CRON[4469]: (root) CMD (systemctl stop nginx && letsencrypt renew && systemctl restart nginx)
Sep 11 12:02:01 ubuntu systemd[1]: Stopping A high performance web server and a reverse proxy server...
Sep 11 12:02:01 ubuntu systemd[1]: Stopped A high performance web server and a reverse proxy server.
Sep 11 12:02:11 ubuntu CRON[4468]: (CRON) info (No MTA installed, discarding output)
Sep 11 12:05:01 ubuntu CRON[4678]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 11 12:09:01 ubuntu CRON[4932]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Sep 11 12:15:01 ubuntu CRON[5396]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 11 12:17:01 ubuntu CRON[5523]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)

Related

I can access the site over SSH but not via HTTP?

I have a wordpress instance on AWS Lightsail.
I can access the VPS via SSH but it won't load over HTTP??
Here is what my error_log is saying:
[Mon May 13 10:58:14.946209 2019] [proxy:error] [pid 2780:tid 139711779657472] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /opt/bitnami/php/var/run/wordpress.sock (wordpress-fpm) failed
[Mon May 13 10:58:14.946221 2019] [proxy_fcgi:error] [pid 2780:tid 139711779657472] [client 78.46.85.236:11708] AH01079: failed to make connection to backend: httpd-UDS
I have checked all services are running. i.e apache2, mySQL & PHP
this isn't Apache complaining. Apache is running just fine and cannot reverse proxy to the unix socket wordpress-fpm. It is likely that there is an issue where the php-fpm service is either not started, or your app is erroring. there should be a separate php error log and apache error log (this looks like the apache one). of course try the below commands to make sure your app is running at all.
$ sudo service php-fpm start # <- start it
$ sudo service php-fpm stop # <- stop it
$ sudo service php-fpm restart # <- restart it
$ sudo service php-fpm reload # <- reload it

rsync "connection refused" error

I'm getting crazy with rsync which gives me a "connection refused" error. Here's my problem:
I have two servers, used to store datas, with rsync installed on because I need that both servers stay synchronized. In this way, modifies on one server will cause the same modifies on the other and viceversa. The first node (sn1) works while the second (sn2) do not. In details.
- sn1 has 192.168.13.131 as ip address
- sn2 has 192.168.13.132 as ip address
If I give rsync rsync://192.168.13.131 from sn1 or sn2, it works fine; while if I give rsync rsync://182.168.13.132 from sn1 or sn2, I get this error:
rsync: failed to connect to 192.168.13.132 (192.168.13.132): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
Here's some information about sn2.
/etc/rsyncd.conf
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.130.132
[account]
max connections = 20
path = /srv/node/
read only = False
lock file = /var/lock/account.lock
[container]
max connections = 20
path = /srv/node/
read only = False
lock file = /var/lock/container.lock
[object]
max connections = 20
path = /srv/node/
read only = False
lock file = /var/lock/object.lock
and /etc/default/rsync
# defaults file for rsync daemon mode
#
# This file is only used for init.d based systems!
# If this system uses systemd, you can specify options etc. for rsync
# in daemon mode by copying /lib/systemd/system/rsync.service to
# /etc/systemd/system/rsync.service and modifying the copy; add required
# options to the ExecStart line.
# start rsync in daemon mode from init.d script?
# only allowed values are "true", "false", and "inetd"
# Use "inetd" if you want to start the rsyncd from inetd,
# all this does is prevent the init.d script from printing a message
# about not starting rsyncd (you still need to modify inetd's config yourself).
RSYNC_ENABLE=true
# which file should be used as the configuration file for rsync.
# This file is used instead of the default /etc/rsyncd.conf
# Warning: This option has no effect if the daemon is accessed
# using a remote shell. When using a different file for
# rsync you might want to symlink /etc/rsyncd.conf to
# that file.
# RSYNC_CONFIG_FILE=
# what extra options to give rsync --daemon?
# that excludes the --daemon; that's always done in the init.d script
# Possibilities are:
# --address=123.45.67.89 (bind to a specific IP address)
# --port=8730 (bind to specified port; default 873)
RSYNC_OPTS=''
# run rsyncd at a nice level?
# the rsync daemon can impact performance due to much I/O and CPU usage,
# so you may want to run it at a nicer priority than the default priority.
# Allowed values are 0 - 19 inclusive; 10 is a reasonable value.
RSYNC_NICE=''
# run rsyncd with ionice?
# "ionice" does for IO load what "nice" does for CPU load.
# As rsync is often used for backups which aren't all that time-critical,
# reducing the rsync IO priority will benefit the rest of the system.
# See the manpage for ionice for allowed options.
# -c3 is recommended, this will run rsync IO at "idle" priority. Uncomment
# the next line to activate this.
# RSYNC_IONICE='-c3'
# Don't forget to create an appropriate config file,
# else the daemon will not start.
Now some logs. /var/log/rsyncd.log
2018/05/04 15:10:16 [889] rsyncd version 3.1.2 starting, listening on port 873
2018/05/04 15:10:16 [889] bind() failed: Cannot assign requested address (address-family 2)
2018/05/04 15:10:16 [889] unable to bind any inbound sockets on port 873
2018/05/04 15:10:16 [889] rsync error: error in socket IO (code 10) at socket.c(555) [Receiver=3.1.2]
Output of ps aux | grep rsync command on sn2:
sn2 1555 0.0 0.1 13136 1060 pts/0 S+ 15:46 0:00 grep --color=auto rsync
Output of ps aux | grep rsync command on sn1:
sn1 12875 0.0 0.1 13136 1012 pts/0 S+ 15:48 0:00 grep --color=auto rsync
root 21281 0.0 0.2 12960 2800 ? Ss 13:31 0:00 /usr/bin/rsync --daemon --no-detach
This is the main difference I see between the two nodes.
Output of the command sudo systemctl status rsync on sn1:
rsync.service - fast remote file copy program daemon
Loaded: loaded (/lib/systemd/system/rsync.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-05-04 13:31:10 UTC; 2h 19min ago
Main PID: 21281 (rsync)
Tasks: 1 (limit: 1113)
CGroup: /system.slice/rsync.service
└─21281 /usr/bin/rsync --daemon --no-detach
May 04 13:31:10 sn1 systemd[1]: Started fast remote file copy program daemon.
Output of the same command in sn2:
rsync.service - fast remote file copy program daemon
Loaded: loaded (/lib/systemd/system/rsync.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-05-04 15:10:16 UTC; 41min ago
Process: 889 ExecStart=/usr/bin/rsync --daemon --no-detach (code=exited, status=10)
Main PID: 889 (code=exited, status=10)
May 04 15:10:15 sn2 systemd[1]: Started fast remote file copy program daemon.
May 04 15:10:16 sn2 systemd[1]: rsync.service: Main process exited, code=exited, status=10/n/a
May 04 15:10:16 sn2 systemd[1]: rsync.service: Failed with result 'exit-code'.
Output of the command sudo netstat -lptu | grep rsync on sn1:
tcp 0 0 sn1:rsync 0.0.0.0:* LISTEN 21281/rsync
while in sn2 it returns nothing...
Finally the sn2 /etc/hosts containt
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#ADDED BY ME
#10.0.2.15 sn2
192.168.13.130 proxy-server
192.168.13.131 sn1
192.168.13.132 sn2
#192.168.13.133 sn3
#192.168.13.134 sn4
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
And sn1 as well:
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#ADDED BY ME
#10.0.2.15 sn1
192.168.13.130 proxy-server
192.168.13.131 sn1
192.168.13.132 sn2
#192.168.13.133 sn3
#192.168.13.134 sn4
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
I'm running ubuntu 18.04 in each server node, on a virtual machine.
Can you help me to figure out what is happening? Unfortunately I must use rsync because I'm working on OpenStack Swift, so no change are allowed :)
Ok, I've done. It was simply, just gain super user privilege and then enable and start rsync process:
sudo su
enter your password, then digit
systemctl enable rsync
systemctl start rsync
if you don't have a systemctl based terminal just use "service" instead.
service rsync restart
You can check that rsync is now working by accessing to /var/log/rsyncd.log. The bind() error is now gone.
With default config, I always do rsync -rtP /home/me/source/ x.x.x.x:/home/someoneelse/source (where x.x.x.x is an actual IP address). I am not aware when or if rsync:// would ever need to be specified as the protocol. In my case, I had your error until I enabled sshd. I also installed rsync-daemon but I do not actually know whether that is needed. Here is the entire solution (I only did this on the remote computer--I believe the local computer, on which I then could run the command above successfully, only had openssh and rsync packages):
sudo dnf -y install rsync-daemon openssh
sudo systemctl enable rsyncd
sudo systemctl start rsyncd
sudo systemctl enable sshd
sudo systemctl start sshd
To be clear, I have Fedora 27, sudo systemctl status firewalld says firewall is running, and I did not have to manually create firewall rules of which I'm aware (there are no instances of firewall or iptables in my bash history). In the command (at the top of this answer) that successfully runs, I used some options but they are not required: r: recursive, t: copy timestamp to destination file,P: show progress. A forward slash (/) is at the end of only the source path, so that rsync doesn't create a directory called /home/someoneelse/source/source in the destination.

Asterisk unable to find master config file

I have strange problem after I've installed Asterisk on my CentOS server. So, I have used tutorial step-by-step and didn't get any error or warnings. Whole installation went successfully.
When I try to log into Asterisk CLI with asterisk -r I've got this error
[root#asterisk-14.6.1]# asterisk -r
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
Unable to connect to remote asterisk (does /usr/local/var/run/asterisk/asterisk.ctl exist?)
[root#asterisk-14.6.1]#
What does this means? I can't find anything about master config file. My asterisk.conf file is in /etc/asterisk
-rw-r--r-- 1 asterisk asterisk 5332 18 sep 12,15 asterisk.conf
not in '/usr/local/etc/asterisk/asterisk.conf'
Asterisk is 100% running
[root#asterisk-14.6.1]# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
Active: active (running) since mon 2017-09-18 12:36:16 EEST; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 33977 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 34000 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 34025 (asterisk)
CGroup: /system.slice/asterisk.service
├─34023 /bin/sh /usr/sbin/safe_asterisk
└─34025 /usr/sbin/asterisk -f -vvvg -c
sep 18 12:36:16 systemd[1]: Starting LSB: Asterisk PBX...
sep 18 12:36:16 asterisk[34000]: Starting asterisk:
sep 18 12:36:16 systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
sep 18 12:36:16 systemd[1]: asterisk.service: Supervising process 34025 which is not our child. We'll most likely not notice when it exits.
sep 18 12:36:16 systemd[1]: Started LSB: Asterisk PBX.
I have changed also this permissions to asterisk user
[root#asterisk-14.6.1]# ls -l /var/run/asterisk/asterisk.ctl
srwxr-xr-x 1 asterisk asterisk 0 18 sep 12,36
/var/run/asterisk/asterisk.ctl
I was able to log into CLI with asterisk -vvvvc and I can see few errors
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
[Sep 18 12:40:24] ERROR[34584]: logger.c:1823 init_logger: Errors detected in logger.conf. Default console logging is being used.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
You did install with /usr/local/ prefix.
Now you have 2 choices
reinstall, do configure with --prefix=/
or do symlink
mkdir -p /usr/local/etc/
ln -s /etc/asterisk /usr/local/etc/
Running
make samples inside /usr/src/asterisk-<your version> resolved the issue for me

Mysql services dies sometimes when you use wordpress

I'm using nginx 1.8.1 on centos 7 64 bit, i have installed wordpress there and it works great, but sometimes when you install plugin, or do some other activity on the site mysql service dies and it shows error establishing a database connection error since the service just died and didn't started again.
So what i did several times when this happened (I'm holding the site on the server ~3 days issue started coming day ago when there where more plugins on the site or more activity i'm not sure whats causing the issue) is connected to the server via putty client and just wrote reboot command that solved the issue, however couple hours ago when the issue randomly just popped up when i was adding simple products on Woocommerce i logged in to server via putty and now just wrote systemctl stop mariadb and than systemctl start mariadb. I tough mysql server just dies randomly, but after 15 minutes it happened again so now i didn't wrote command to stop maria db i just wrote systemctl start mariadb and it didn't worked, what it says is:
[root#lrweb ~]# systemctl start mariadb
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
So next thing i did is wrote command to check status( systemctl status mariadb
): and it shows:
[root#lrweb ~]# systemctl status mariadb
mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
Active: failed (Result: exit-code) since Tue 2016-02-09 03:48:11 EST; 45s ago
Process: 24708 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 24707 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 24680 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 24707 (code=exited, status=0/SUCCESS)
So now i decided to stop maria db and start again like i did before but once i type command to stop maria db it outputs nothing just
[root#lrweb ~]# systemctl stop mariadb
[root#lrweb ~]#
But when i type again for start the service it does not start and gives me same
message as i wrote above.
I'm sure that i can resolve this issue by rebooting the server which would start services all automatically.
I'm using digital ocean in in there i decided to go and check resources, i have there server which is medium one and it can't be that high but apparently i was wrong because it shows that all resources was at max:
Click to see resource graphs
I'm not sure whats causing the problem, how to fix it and what i do wrong.
Thanks for your time and help.

Can only run uwsgi with root

I'm preparing to use nginx/uwsgi with flask for a website i'm developing, but i'm running into problems. NB the website itself runs great using flask's debug :5000 port, but i want to go into production now. To explain what i did.
It's a linode ubuntu 12.04LTS server, I installed it like this:
# install nginx
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get upgrade --show-upgraded
sudo apt-get install nginx-full
# installing uwsgi
sudo apt-get install build-essential python-dev libxml2-dev
sudo apt-get install libc6 libexpat1 libgd2-xpm libgeoip1 libpam0g libpcre3 libssl1.0.0 libxml2 libxslt1.1 zlib1g
sudo pip install uwsgi
# python basics
sudo apt-get install python-pip build-essential python-dev
sudo pip install virtualenv
sudo pip install virtualenvwrapper
sudo mkdir -p /srv/www/li/
cd /srv/www/li/
virtualenv venv
source /srv/www/li/venv/bin/activate
pip install flask
Then i set out to configure everything, but I already run into trouble with uwsgi (never mind NGINX, which will be the next step.
sudo nano /etc/uwsgi/apps-available/li.xml
<uwsgi>
<plugin>python</plugin>
<socket>/run/uwsgi/app/li.socket</socket>
<chmod-socket>666</chmod-socket>
<chdir>/srv/www/li</chdir>
<pythonpath>/srv/www/li</pythonpath>
<virtualenv>/srv/www/li/venv</virtualenv>
<module>li</module>
<wsgi-file>/srv/www/li/li.py</wsgi-file>
<callable>app</callable>
<master/>
<processes>4</processes>
<harakiri>60</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-rss>192</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>
sudo ln -s /etc/uwsgi/apps-available/li.xml /etc/uwsgi/apps-enabled/li.xml
However if i run it, i get:
uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
open("./python_plugin.so"): No such file or directory [core/utils.c line 4755]
!!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 16:30:53 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /run/uwsgi/app
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /run/uwsgi/app/li.socket fd 3
Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
Set PythonHome to /srv/www/li/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xa86e20
your server socket listen backlog is limited to 100 connections
mapped 362120 bytes (353 KB) for 4 cores
*** Operational MODE: preforking ***
added /srv/www/li/ to pythonpath.
/srv/www/li/venv/local/lib/python2.7/site-packages/mongoengine/fields.py:744: FutureWarning: ReferenceFields will default to using ObjectId strings in 0.8, set DBRef=True if this isn't desired
warnings.warn(msg, FutureWarning)
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xa86e20 pid: 14934 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14934)
spawned uWSGI worker 1 (pid: 14940, cores: 1)
mapping worker 1 to CPUs: 0
spawned uWSGI worker 2 (pid: 14941, cores: 1)
mapping worker 2 to CPUs: 1
spawned uWSGI worker 3 (pid: 14942, cores: 1)
mapping worker 3 to CPUs: 2
spawned uWSGI worker 4 (pid: 14943, cores: 1)
unlink(): Operation not permitted [core/socket.c line 109]
bind(): Address already in use [core/socket.c line 141]
...brutally killing workers...
mapping worker 4 to CPUs: 3
VACUUM: unix socket /run/uwsgi/app/li.socket removed.
So i get the unlink operation not permitted and the bind address already in use errors (next to the python_plugin error of which i also have no clue how to solve that!). If i run as sudo, it seems to work fine ->
sudo uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
open("./python_plugin.so"): No such file or directory [core/utils.c line 4755]
!!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 15:47:41 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /run/uwsgi
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /run/uwsgi/app/li.socket fd 3
Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
Set PythonHome to /srv/www/li/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1fc9d00
your server socket listen backlog is limited to 100 connections
mapped 362120 bytes (353 KB) for 4 cores
*** Operational MODE: preforking ***
added /srv/www/li/ to pythonpath.
/srv/www/li/venv/local/lib/python2.7/site-packages/mongoengine/fields.py:744: FutureWarning: ReferenceFields will default to using ObjectId strings in 0.8, set DBRef=True if this isn't desired
warnings.warn(msg, FutureWarning)
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1fc9d00 pid: 14755 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14755)
spawned uWSGI worker 1 (pid: 14761, cores: 1)
mapping worker 1 to CPUs: 0
spawned uWSGI worker 2 (pid: 14762, cores: 1)
mapping worker 2 to CPUs: 1
spawned uWSGI worker 3 (pid: 14763, cores: 1)
mapping worker 3 to CPUs: 2
spawned uWSGI worker 4 (pid: 14764, cores: 1)
*** Stats server enabled on /tmp/stats.socket fd: 16 ***
mapping worker 4 to CPUs: 3
Can anyone please help me? As www-data is in the www-data group and he runs it, I tried some stuff:
sudo usermod -a -G www-data $USER
sudo chown -R $USER:www-data /srv/www/li
sudo chmod -R g+r+w+x /srv/www/li
sudo chown -R $USER:www-data /etc/uwsgi/apps-enabled
sudo chmod -R g+r+w+x /etc/uwsgi/apps-enabled
sudo chown -R $USER:www-data /run/uwsgi/app
sudo chmod -R g+r+w+x /run/uwsgi/app
But that really didn't help either. I also tried a tcp port instead of the unix /run/uwsgi/app/ port that didn't make any difference either...
This is driving me crazy :( I hope someone has a clue on what's happening here.
Kind regards,
Carst
edit: after a server restart it still gives an erro but a different one:
geoadmin#demo:~$ uwsgi --xml /etc/uwsgi/apps-enabled/li.xml
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/li.xml
*** Starting uWSGI 1.4.6 (64bit) on [Thu Feb 28 18:47:36 2013] ***
compiled with version: 4.6.3 on 28 February 2013 12:38:22
os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013
nodename: demo
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /home/geoadmin
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 63594
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
bind(): No such file or directory [core/socket.c line 141]
This was consistently my #1 result on google, and this page was relatively unhelpful to me, so I'm going to add my answer, even though it's fairly obvious in retrospect.
My problem was a permissions problem with my stats socket. If you change your uWSGI config's uid or gid parameters, make sure you either chmod or rm all of your old sockets/ pids, and their parent folders.
In my case I was trying to place the .sock file in the /vagrant directory, which is a machine mounted folder of virtual box and is not good for much more than reads and writes.
Place the .sock file outside of a virtualbox mount-point preferably in /tmp The FHS says: /var/run
Ref:
https://stackoverflow.com/a/7580524/1695680
Ok, after the later edit i checked the directories and the socket directory didnt exist (anymore); i think it had to do with the original apt-get install versus my later pip install... still have the issue with the python plugin but will check if it's necessary for nginx or if it will work without it... 8 hours of work over a reset, d'oh ;)
#bearrito:
In the end I put the socket in the tmp directory to avoid rights issues:
<uwsgi>
<uid>www-data</uid>
<gid>www-data</gid>
<plugin>python</plugin>
<socket>/tmp/li.socket</socket>
<chmod-socket>666</chmod-socket>
<chdir>/srv/www/li</chdir>
<pythonpath>/srv/www/li</pythonpath>
<virtualenv>/srv/www/li/venv</virtualenv>
<module>li</module>
<wsgi-file>/srv/www/li/li.py</wsgi-file>
<callable>app</callable>
<master/>
<processes>2</processes>
<pidfile>/tmp/li.pid</pidfile>
<harakiri>120</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>2048</limit-as>
<reload-on-as>2048</reload-on-as>
<reload-on-rss>1024</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>
I hope this helps!
For me the solution was to remove /var/run/uwsgi/.sock and
chmod 775 /var/run/uwsgi
chmod 777 /var/log/uwsgi
or wherever your uwsgi files are.

Resources