I upgraded apache from 2.4.25 to 2.4.29 due to security reasons in Mac OSX.
Also installed mod_wsgi via pip.
Now facing difficulty while restarting the apache server!
I ran this command as per the mod_wsgi docs,
> mod_wsgi-express module-config
LoadModule wsgi_module "/Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so"
WSGIPythonHome "/System/Library/Frameworks/Python.framework/Versions/2.7"
Copied the above two lines in apache.conf file and tried to start the apache server but getting the following error:
> sudo apachectl start
/usr/local/apache/bin/apachectl: line 79: 51863 Illegal instruction: 4 $HTTPD -k $ARGV
Any help would be appreciated. Thanks!
EDIT as per Graham answer:
# I upgraded the mod_wsgi
> sudo pip install --upgrade --no-cache-dir mod_wsgi
Collecting mod_wsgi
Downloading mod_wsgi-4.5.21.tar.gz (2.5MB)
100% |████████████████████████████████| 2.5MB 2.1MB/s
Installing collected packages: mod-wsgi
Found existing installation: mod-wsgi 4.5.20
Uninstalling mod-wsgi-4.5.20:
Successfully uninstalled mod-wsgi-4.5.20
Running setup.py install for mod-wsgi ... done
Successfully installed mod-wsgi-4.5.21
But when i tried:
> mod_wsgi-express start-server
Traceback (most recent call last):
File "/Library/WebServer/Documents/DSFENV/bin/mod_wsgi-express", line 11, in <module>
load_entry_point('mod-wsgi==4.5.21', 'console_scripts', 'mod_wsgi-express')()
File "/Library/WebServer/Documents/DSFENV/lib/python2.7/site-packages/mod_wsgi/server/__init__.py", line 3484, in main
cmd_start_server(args)
File "/Library/WebServer/Documents/DSFENV/lib/python2.7/site-packages/mod_wsgi/server/__init__.py", line 3332, in cmd_start_server
config = _cmd_setup_server('start-server', args, vars(options))
File "/Library/WebServer/Documents/DSFENV/lib/python2.7/site-packages/mod_wsgi/server/__init__.py", line 2999, in _cmd_setup_server
language, encoding = locale.getdefaultlocale()
File "/Library/WebServer/Documents/DSFENV/lib/python2.7/locale.py", line 543, in getdefaultlocale
return _parse_localename(localename)
File "/Library/WebServer/Documents/DSFENV/lib/python2.7/locale.py", line 475, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
getting the above error.
Also I have installed apache 2.4.29 following this blog:
2nd Edit
I have resolved ValueError: unknown locale: UTF-8, now the output of mod_wsgi-express start-server shows:
> mod_wsgi-express start-server
Server URL : http://localhost:8000/
Server Root : /tmp/mod_wsgi-localhost:8000:501
Server Conf : /tmp/mod_wsgi-localhost:8000:501/httpd.conf
Error Log File : /tmp/mod_wsgi-localhost:8000:501/error_log (warn)
Request Capacity : 5 (1 process * 5 threads)
Request Timeout : 60 (seconds)
Startup Timeout : 15 (seconds)
Queue Backlog : 100 (connections)
Queue Timeout : 45 (seconds)
Server Capacity : 20 (event/worker), 20 (prefork)
Server Backlog : 500 (connections)
Locale Setting : en_US.UTF-8
But when I try to do config test, still showing the same error:
> sudo apachectl configtest
/usr/local/apache/bin/apachectl: line 79: 53944 Illegal instruction: 4 $HTTPD -t
xcode version:
> xcodebuild -version
Xcode 8.3.2
Build version 8E2002
3rd EDIT as per comments:
> /usr/local/apache/bin/httpd
Illegal instruction: 4
> /Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so
-bash: /Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so: cannot execute binary file
> sys.prefix
'/System/Library/Frameworks/Python.framework/Versions/2.7'
> sys.version
'2.7.10 (default, Feb 7 2017, 00:08:15) \n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]'
I followed this blog to install Apache 2.4.29:
http://mac-dev-env.patrickbougie.com/apache/
--with-ssl option as we need to https for the website.
4th EDIT:
> file /usr/local/apache/bin/httpd
/usr/local/apache/bin/httpd: Mach-O 64-bit executable x86_64
> file /Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so
/Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so: Mach-O universal binary with 2 architectures: [x86_64: Mach-O 64-bit bundle x86_64] [i386: Mach-O bundle i386]
/Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
/Library/Python/2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so (for architecture i386): Mach-O bundle i386
Please let me know how to proceed forward.
If you have updated your Apache installation in some way, usually the mod_wsgi.so binary from an older release should still work as Apache maintains ABI compatibility across patch level updates.
If it isn't working, then you may need to re-build mod_wsgi. If there is no newer version of mod_wsgi, you will need to force a full re-build to ensure cached binaries from pip cache are not used.
pip install --upgrade --no-cache-dir mod_wsgi
Next problem though is if you have upgraded to Xcode 9.1, Apple have further broken things by completely removing apxs, meaning that my prior workaround for Apple brokeness no longer works. In this case you need to ensure you are installing mod_wsgi 4.5.21 or later. That version only just got released with fixes to accomodate for Xcode 9.1
So try that pip command above and make sure mod_wsgi-express still works by running:
mod_wsgi-express start-server
Then validate configuration snippet to use in Apache config by running again:
mod_wsgi-express module-config
If still issues with main Apache, then ensure you do a complete stop of Apache and then a start, and not just restart. Let me know how that all goes.
UPDATE 1
Above presumes you were using Apple supplied Apache in respect of Xcode 9.1 comments. You seem to be using your own Apache, maybe form Homebrew. Still try the same thing.
As suggested by Graham:
pip install --upgrade --no-cache-dir mod_wsgi
Upgrade to mod_wsgi 4.5.22 did the trick.
Related
I'm getting an error trying to start apache which uses mod_wsgi 4.9.1 in a virtual environment.
On my centos 7 system, I compiled python 3.10, which is altinstalled to /usr/local/bin/python3.10
I have a virtualenv, but may have initially built mod_wsgi with an earlier version of python 3.10 (I was having trouble getting python to build correctly). However, my last attempt I used
pip install --ignore-installed --no-cache-dir mod_wsgi==4.9.1 --no-binary mod_wsgi
to try to get it to build with the latest python3.10 (I tried several pip installs, starting with just --no-cache-dir)
Note I am trying to upgrade several applications to python3.10, from centos7 yum installed python 3.6, mod_wsgi 4.7.0, which was working. So this likely has something to do with my python installation, or connecting mod_wsgi to the python installation.
I tried running mod_wsgi-express setup-server, and get these results
$ sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/custom-openssl/lib /root/bin/init-mod_wsgi-express runningroutes sandbox.routes.loutilities.com routesmgr routesmgr 8002
Server URL : http://proxysvr.loutilities.com:8002/
Server Root : /etc/mod_wsgi-express/sandbox.routes.loutilities.com
Server Conf : /etc/mod_wsgi-express/sandbox.routes.loutilities.com/httpd.conf
Error Log File : /etc/mod_wsgi-express/sandbox.routes.loutilities.com/error_log (warn)
Rewrite Rules : /etc/mod_wsgi-express/sandbox.routes.loutilities.com/rewrite.conf
Environ Variables : /etc/mod_wsgi-express/sandbox.routes.loutilities.com/envvars
Control Script : /etc/mod_wsgi-express/sandbox.routes.loutilities.com/apachectl
Operating Mode : daemon
Request Capacity : 5 (1 process * 5 threads)
Request Timeout : 60 (seconds)
Startup Timeout : 15 (seconds)
Queue Backlog : 100 (connections)
Queue Timeout : 45 (seconds)
Server Capacity : 20 (event/worker), 20 (prefork)
Server Backlog : 500 (connections)
Locale Setting : en_US.UTF-8
where
$ sudo cat /root/bin/init-mod_wsgi-express
#!/bin/bash
if [[ $# -lt 5 ]] ; then
echo "usage:"
echo " init-mod_wsgi-express project servername user group port"
exit 0
fi
source /var/www/$2/venv/bin/activate
mod_wsgi-express setup-server --server-name proxysvr.loutilities.com --port $5 --user $3 --group $4 /var/www/$2/$1/$1/$1.wsgi --working-directory /var/www/$2/$1/$1/ --server-root /etc/mod_wsgi-express/$2
deactivate
but I see an error when trying to start the created apachectl file
$ sudo /etc/mod_wsgi-express/sandbox.routes.loutilities.com/apachectl start
httpd (mod_wsgi-express): Syntax error on line 163 of /etc/mod_wsgi-express/sandbox.routes.loutilities.com/httpd.conf: Cannot load /var/www/sandbox.routes.loutilities.com/venv/lib/python3.10/site-packages/mod_wsgi/server/mod_wsgi-py310.cpython-310-x86_64-linux-gnu.so into server: /var/www/sandbox.routes.loutilities.com/venv/lib/python3.10/site-packages/mod_wsgi/server/mod_wsgi-py310.cpython-310-x86_64-linux-gnu.so: undefined symbol: GENERAL_NAME_free
I notice the following from the python build directory
$ grep -R GENERAL_NAME_free .
./Modules/_ssl.c: sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
Binary file ./Modules/_ssl.o matches
Binary file ./python matches
Binary file ./libpython3.10.a matches Binary file
./Programs/_testembed matches
and libpython3.10.a is in /usr/local/lib and /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
$ find /usr/local/lib -name libpython3.10.a
/usr/local/lib/libpython3.10.a
/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a
I'm not sure how mod_wsgi in the virtual environment should be set up to find the missing library file.
What other debugging steps should I take?
Note I also posted to https://groups.google.com/g/modwsgi about a week ago but didn't see any responses.
This was answered in https://groups.google.com/g/modwsgi/c/KZZQHpFclGA/m/9St6XuSRAAAJ
Essentially, the problem is that python is using a different openssl than apache.
I have tried to repo init the source code Ubuntu build machine and it is successfully able to clone the code.
repo init -u git#github.com:xxx/xx_manifest.git -b xxx
Now I am trying repo init the source code in VM Ubuntu machine.
In between getting the error like below:
Traceback (most recent call last):
File "/xxx/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
File "/xxx/.repo/repo/subcmds/__init__.py", line 38, in <module>
['%s' % name])
File "/xxx/.repo/repo/subcmds/upload.py", line 27, in <module>
from hooks import RepoHook
File "/xxx/.repo/repo/hooks.py", line 472
file=sys.stderr)
^
SyntaxError: invalid syntax
python version is same in build machine and vm machine 2.7.17.
try these commands
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo
python3 ~/bin/repo init -u git#....
I just had the same issue and this resolved it for me :
Download last version of repo :
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > repo
Change right to make it executable : chmod a+x repo
Run your repo init with python3 and the "repo" you just download : python3 repo init -u git#github.com:xxx/xx_manifest.git -b xxx
I have experienced the same issue on Ubuntu 18.04 during the installation of the OpenSTLinux Yocto layer with the following command:
repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-5.4-dunfell-mp1-20-11-12
Returns:
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
remote: Counting objects: 2, done
remote: Finding sources: 100% (117/117)
remote: Total 117 (delta 63), reused 117 (delta 63)
Receiving objects: 100% (117/117), 142.25 KiB | 11.85 MiB/s, done.
Resolving deltas: 100% (63/63), completed with 32 local objects.
From https://gerrit.googlesource.com/git-repo
1469c28..0588f3d main -> origin/main
* [new tag] v2.11 -> v2.11
* [new tag] v2.11.1 -> v2.11.1
Traceback (most recent call last):
File "/home/xxx/Distribution-Package/openstlinux-5.4-dunfell-mp1-20-11-12/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
File "/home/xxx/Distribution-Package/openstlinux-5.4-dunfell-mp1-20-11-12/.repo/repo/subcmds/__init__.py", line 38, in <module>
['%s' % name])
File "/home/xxx/Distribution-Package/openstlinux-5.4-dunfell-mp1-20-11-12/.repo/repo/subcmds/upload.py", line 27, in <module>
from hooks import RepoHook
File "/home/xxx/Distribution-Package/openstlinux-5.4-dunfell-mp1-20-11-12/.repo/repo/hooks.py", line 472
file=sys.stderr)
This issue goes away with using Python3 instead of Python (2.7). You can do this:
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3 /usr/bin/python
Try below command to make it will work 100%, tried & suggested
mkdir -p ~/.bin
PATH="${HOME}/.bin:${PATH}"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+rx ~/.bin/repo
One solution is to modify the first line of /usr/bin/repo and change it from
#!/usr/bin/python
to
#!/usr/bin/python3
This asks the system to use Python3 instead of the default Python.
If the system you are running on doesn't have python3, like in my case, and you don't have the option to install python3, or installing it breaks other parts, the option is the degrade repo to a version that uses python2.7:
- git clone https://gerrit.googlesource.com/git-repo
- cd git-repo
- git reset --hard v1.13.11
- mkdir -p ~/.bin
- PATH="${HOME}/.bin:${PATH}"
- cp repo ~/.bin/repo
- chmod a+rx ~/.bin/repo
This will use v1.13.11 of repo, which works with python2.7
As seen in a similar error in arvestad/alv issue 1, that would be consistent with running the process with Python 2.7 instead of Python3
Double-check you Python version between:
your Ubuntu build machine (where the repo init works)
your VM Ubuntu machine (where the repo init fails)
Same error here, with the error suggesting you are executing python2 with a PYTHONPATH that's only appropriate for python3.
I don't know exactly how this works, but i just had the same issue and this resolved it for me it seems.
https://source.android.com/setup/develop#installing-repo
Dont use the legacy one, use the first one to resolve it.
Edit: It seems you also need to have python 3.6 installed on you system to have this work. You can still have update-alternatives point to python 2.7, you simply need 3.6 or newer installed.
Just install python3 and the latest repo.
I encountered the problem too, but on Mac OS. The log is exactly the same as yours.
Definitely python2 caused this problem. repo is try to run python3 files in python2 environment.
I found the this from repo docs https://gerrit.googlesource.com/git-repo/+/refs/heads/master/docs/python-support.md
So I update my repo (which located in depot_tools). Since I already have python3 installed, everything is ok now.
Hope my experience may help you.
I'm getting this error while installing/listing firefox or python on a Linux server. Any ideas how to fix it.
# yum install firefox
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/usr/lib64/libnssutil3.so: undefined symbol: PL_ClearArenaPool
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.4.3 (#1, Oct 23 2012, 22:02:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq
Instead of getting the following output/value for firefox -version command.
$ firefox --version
Mozilla Firefox 17.0.9
I'm getting:
XPCOMGlueLoad error for file /opt/firefox/libxpcom.so:
libxul.so: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
python -h command output looks valid.
python -V shows:
Python 2.4.3
When I'm running Selenium tests (which requires firefox and Xvfb), I get the following error:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
XPCOMGlueLoad error for file /opt/firefox/libxpcom.so:
libxul.so: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
XPCOMGlueLoad error for file /opt/firefox/libxpcom.so:
libxul.so: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
The problem is not python, it’s the LD_LIBRARY_PATH that does not include /lib64 and /usr/lib64 setting values. we fixed this by pre-pending /lib64:/usr/lib64 to the LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=/usr/lib64/:/lib64:$LD_LIBRARY_PATH
After this point, when I did yum help or yum install firefox (it didn't give the above error) BUT:
firefox --version still gave the error:
XPCOMGlueLoad error for file /opt/firefox/libxpcom.so:
libxul.so: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
Now, I finally ran yum install firefox and it installed bunch of components and at the end said:
Installing : alsa-lib 20/23
Installing : xulrunner 21/23
Installing : firefox 22/23
Installing : firefox 23/23
Installed:
firefox.i386 0:17.0.9-1.el5_9 firefox.x86_64 0:17.0.9-1.el5_9
Dependency Installed:
GConf2.i386 0:2.14.0-9.el5 ORBit2.i386 0:2.14.3-5.el5 alsa-lib.i386 0:1.0.17-1.el5 atk.i386 0:1.12.2-1.fc6 avahi.i386 0:0.6.16-10.el5_6 avahi-glib.i386 0:0.6.16-10.el5_6 cairo.i386 0:1.2.4-5.el5
cups-libs.i386 1:1.3.7-30.el5_9.3 gamin.i386 0:0.1.7-10.el5 gnome-vfs2.i386 0:2.16.2-12.el5_9 gnutls.i386 0:1.4.1-10.el5_9.2 gtk2.i386 0:2.10.4-29.el5 libIDL.i386 0:0.8.7-1.fc6 libXcursor.i386 0:1.1.7-1.2
libXfixes.i386 0:4.0.1-2.1 libXinerama.i386 0:1.0.1-2.1 libXrandr.i386 0:1.1.1-3.3 libacl.i386 0:2.2.39-8.el5 libattr.i386 0:2.4.32-1.1 pango.i386 0:1.14.9-8.el5_7.3 xulrunner.i386 0:17.0.9-1.el5_9
Complete!
Now firefox version is showing correctly.
firefox --version
Mozilla Firefox 17.0.9
Everything is working now.
I've just installed Cassandra using brew on Mac OS X 10.9.4:
➜ ~ brew info cassandra
cassandra: stable 2.1.0
http://cassandra.apache.org
/usr/local/Cellar/cassandra/2.0.9 (3466 files, 79M) *
Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cassandra.rb
==> Caveats
If you plan to use the CQL shell (cqlsh), you will need the Python CQL library
installed. Since Homebrew prefers using pip for Python packages, you can
install that using:
pip install cql
To have launchd start cassandra at login:
ln -sfv /usr/local/opt/cassandra/*.plist ~/Library/LaunchAgents
Then to load cassandra now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
➜ ~ uname -a
Darwin xxx 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
As advised in the above info message, to install cql I executed sudo easy_install pip followed by pip install cql.
With the software installed, upon executing cqlsh I'm facing the error:
➜ ~ cqlsh
Traceback (most recent call last):
File "/usr/local/bin/cqlsh", line 2084, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/usr/local/bin/cqlsh", line 2067, in main
single_statement=options.execute)
File "/usr/local/bin/cqlsh", line 509, in __init__
self.output_codec = codecs.lookup(encoding)
LookupError: unknown encoding:
How can I fix it?
After some googling and debugging, it turned out that the call to locale.getpreferredencoding() expects proper LC_ALL as described in 22.2. locale — Internationalization services:
To maintain compatibility with other platforms, not only the LANG
variable is tested, but a list of variables given as envvars
parameter. The first found to be defined will be used. envvars
defaults to the search path used in GNU gettext; it must always
contain the variable name LANG. The GNU gettext search path contains
'LANGUAGE', 'LC_ALL', 'LC_CTYPE', and 'LANG', in that order.
On my system LC_ALL was set to pl_PL:
➜ ~ echo $LC_ALL
pl_PL
After a change to LC_ALL to pl or pl_pl.utf-8 the Cassandra shell cqlsh started fine:
➜ ~ export LC_ALL=pl_pl.utf-8
➜ ~ cqlsh
Connected to Test Cluster at localhost:9160.
[cqlsh 4.1.1 | Cassandra 2.0.9 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.
cqlsh>
See the thread Problem start cqlsh on OSX - Lion for a sample Python application to check your locale:
python -c 'import locale, codecs; encoding = locale.getpreferredencoding(); print encoding; print codecs.lookup(encoding)'
Once it's worked fine, the issue can be considered solved.
I installed as the http://www.reinbach.com/uwsgi-nginx-flask-virtualenv-mac-os-x.html link's tutorial and when executing the command uwsgi --ini deploy/deploy.ini, the terminal says there was an import error:
Set PYTHONHOME to /virtualenv/sample/
ImportError: No module named site
I have set my PYTHONHOME and PYTHONPATH as
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages
export PYTHONHOME=$PYTHONHOME:/Library/Python/2.7
I cannot figure out what wrong with it.
Could someone help me with the problem?
The whole info in the terminal is shown as below if it is helpful:
(env)ios-devmatoMacBook-Pro:hello ios_dev$ uwsgi --ini deploy/deploy.ini
[uWSGI] getting INI configuration from deploy/deploy.ini
*** Starting uWSGI 1.9.10 (64bit) on [Fri May 17 16:42:22 2013] ***
compiled with version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on 17 May 2013 12:41:07
os: Darwin-11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-
1699.32.7~1/RELEASE_X86_64
nodename: ios-devmatoMacBook-Pro.local
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /Users/ios_dev/Desktop/sample/hello
detected binary path: /Users/ios_dev/Documents/little/little-web/little_web_dev/env/bin/uwsgi
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
Set PYTHONHOME to /virtualenv/sample/
ImportError: No module named site
Here's how I resolved the same error message (ImportError: No module named site) that I got while trying the Django and NGINX tutorial — uWSGI 2.0 documentation.
Deactivate the virtualenv:
deactivate
Install uWSGI system-wide (if not already installed system-wide)
sudo pip install uwsgi
Edit the uwsgi.ini file. I commented out the line with the:
home = /path/to/virtualenv
Run uWSGI --ini mysite_uwsgi.ini.
I read a lot of document about the question, but get no answer.
By coincidentally, I fix this problem by edit uid and gid as root.
It seem like a permissions problem. I don't know why, but it just work. Remember, it is very unsafe to run a product environment as root.
1、active the virtual you used
2、 pip install uwsgi
this the key action,then the
command -v wsgi
show this
/virtual-path/bin/uwsgi
3、use current user to run uwsgi, because other user is not active the virtualenv
Im My case I wasn't using virtualEnv. Just using django + ngnix. My solution was removing HOME variable into the *.ini configuration file:
sudo nano /etc/uwsgi/sites/c_app.ini
[uwsgi]
project = c_app
uid = ubuntu
base = /home/%(uid)
chdir = %(base)/%(project)
**home = %(base)/%(project)** (REMOVED IT)
module = %(project).wsgi:application
master = true
processes = 5
socket = /run/uwsgi/%(project).sock
chown-socket = %(uid):www-data
chmod-socket = 660
vacuum = true
then it works.