首页 \ 问答 \ Apache2 + VirtualEnv IO错误:[Errno 13]权限被拒绝(Apache2 + VirtualEnv IOError: [Errno 13] Permission denied)

Apache2 + VirtualEnv IO错误:[Errno 13]权限被拒绝(Apache2 + VirtualEnv IOError: [Errno 13] Permission denied)

我无法通过virtualenv(和virtualenvwrapper)让apache服务我的网站。 我试着在这里进行演练。 值得注意的是,我使用的是Ubuntu Server v13.10,我读过它并没有本地支持Apache v2.2,因此在演练中我无法安装apache2.2-common。 但是,我不认为这是问题,因为Apache错误日志说有权限问题。

在我的设置中,虚拟环境存在于非root用户的主目录中,而apache服务器以root身份运行(我认为这很正常)。 我试图使用namei来追踪权限,并且确保以root身份将chmod +rw到路径中。 有任何想法吗?

[Thu Mar 06 14:16:37.639031 2014] [mpm_event:notice] [pid 8771:tid 140338386122624] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Thu Mar 06 14:16:37.639144 2014] [core:notice] [pid 8771:tid 140338386122624] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 06 14:16:53.456622 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Target WSGI script '/var/www/www.mysite.org/index.wsgi' cannot be loaded as Python module.
[Thu Mar 06 14:16:53.456735 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Exception occurred processing WSGI script '/var/www/www.mysite.org/index.wsgi'.
[Thu Mar 06 14:16:53.456782 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] Traceback (most recent call last):
[Thu Mar 06 14:16:53.456830 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742]   File "/var/www/www.mysite.org/index.wsgi", line 16, in <module>
[Thu Mar 06 14:16:53.456918 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742]     execfile(activate_env, dict(__file__=activate_env))
[Thu Mar 06 14:16:53.456971 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] IOError: [Errno 13] Permission denied: '/home/nrUser/Envs/mysite/bin/activate_this.py'
(mysite)root:~# namei -m /home/nrUser/Envs/mysite/bin/activate_this.py
f: /home/nrUser/Envs/mysite/bin/activate_this.py
 drwxr-xr-x /
 drwxr-xr-x home
 drw-r--r-- nrUser
 drwxrwxr-x Envs
 drwxrwxr-x mysite
 drwxrwxr-x bin
 -rwxrwxr-x activate_this.py

I am having trouble getting apache to serve my site via virtualenv (and virtualenvwrapper). I tried following the walkthrough here. Of note, I am using Ubuntu Server v13.10 which I've read doesn't have native support for Apache v2.2 yet, thus in the walkthrough I was not able to install apache2.2-common. However, I don't think that is the issue as the apache error logs are saying there is a permissions problem.

In my setup the virtual environment lives in a non-root user's home directory, while the apache server runs as root (I think this is normal). I have tried to trace the permissions using namei and I've made sure to chmod +rw to the path as root. Any ideas?

[Thu Mar 06 14:16:37.639031 2014] [mpm_event:notice] [pid 8771:tid 140338386122624] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Thu Mar 06 14:16:37.639144 2014] [core:notice] [pid 8771:tid 140338386122624] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 06 14:16:53.456622 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Target WSGI script '/var/www/www.mysite.org/index.wsgi' cannot be loaded as Python module.
[Thu Mar 06 14:16:53.456735 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Exception occurred processing WSGI script '/var/www/www.mysite.org/index.wsgi'.
[Thu Mar 06 14:16:53.456782 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] Traceback (most recent call last):
[Thu Mar 06 14:16:53.456830 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742]   File "/var/www/www.mysite.org/index.wsgi", line 16, in <module>
[Thu Mar 06 14:16:53.456918 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742]     execfile(activate_env, dict(__file__=activate_env))
[Thu Mar 06 14:16:53.456971 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] IOError: [Errno 13] Permission denied: '/home/nrUser/Envs/mysite/bin/activate_this.py'
(mysite)root:~# namei -m /home/nrUser/Envs/mysite/bin/activate_this.py
f: /home/nrUser/Envs/mysite/bin/activate_this.py
 drwxr-xr-x /
 drwxr-xr-x home
 drw-r--r-- nrUser
 drwxrwxr-x Envs
 drwxrwxr-x mysite
 drwxrwxr-x bin
 -rwxrwxr-x activate_this.py

原文:https://stackoverflow.com/questions/22234238
更新时间:2024-02-17 13:02

最满意答案

从编程上讲,您可以使用GetType().IsValueType

在Visual Studio中,您还可以使用对象浏览器进行检查(如下所示,位于“查看” - >“对​​象浏览器”下)。

对象浏览器


Programmatically speaking, you can use GetType().IsValueType.

From Visual Studio, you can also check by using the Object Browser (shown below, found under View -> Object Browser).

object browser

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。