Articles of mod wsgi

Apache显示“Python版本不匹配”与mod_wsgi

我试图让web.py工作。 我已经编译mod_wsgi来使用python2.6,并正确configuration了我的虚拟主机(至less我确定它是!)。 你好,世界应用程序不断显示为404。我将Apache的日志级别更改为info。 并看到以下内容: [Wed Sep 28 15:41:12 2011] [info] mod_wsgi (pid=25969): Attach interpreter ''. [Wed Sep 28 15:42:55 2011] [info] mod_wsgi (pid=25969): Create interpreter 'clearpoint.turnleftllc.com|/budgetcalculator'. [Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Destroying interpreters. [Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Destroy interpreter 'clearpoint.turnleftllc.com|/budgetcalculator'. [Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): […]

使用Django和mod_wsgi通过httpd.confredirect

我试图在Django捕获请求之前使用Apache的Rewrite模块redirect用户。 我尝试了以下将用户从“test.php”redirect到“链接”页面 <VirtualHost 10.0.0.3> WSGIDaemonProcess mydomain.com processes=1 threads=15 display-name=$ WSGIProcessGroup mydomain.com DocumentRoot "/home/james/www" <Directory "/home/james/www"> Options +FollowSymlinks RewriteEngine On RewriteRule ^test.php links [NC,R=301,L] Order allow,deny Allow from all </Directory> WSGIScriptAlias / "/home/james/www/app.wsgi" ServerName mydomain.com </VirtualHost> 这种方法不起作用(当浏览到mydomain.com/test.php时,它不会将我redirect到“链接”页面)。 有没有办法用mod_wsgi实现重写?

Apache + LDAP身份validation中缺less“AUTHENTICATE_”环境variables

根据Apache 2.2文档 ,在对Active Directory成功进行身份validation之后, AuthLDAPUrl伪指令中指定的LDAP属性应该可用作默认前缀AUTHENTICATE_环境variables。 但是,在Debian 6.0.4 + Apache 2.2.16 + mod_wsgi上,env vars没有设置。 我可以无问题地进行身份validation,而其他一切正常。 有什么我可以做,让他们设置? 较新版本的Apache和/或LDAP模块?

configurationvarnish和django(apache / modwsgi)

我正在努力解决为什么我的应用程序不断打到数据库,而我已经build立了Apache的清漆面前。 我想我缺less一些重要的configuration,欢迎提供任何提示 这是我的卷发结果: HTTP/1.1 200 OK Server: Apache/2.2.16 (Debian) Content-Language: en-us Vary: Accept,Accept-Encoding,Accept-Language,Cookie Cache-Control: s-maxage=60, no-transform, max-age=60 Content-Type: application/json; charset=utf-8 Date: Sat, 15 Sep 2012 08:19:17 GMT Connection: keep-alive 我的清漆: 13 BackendClose – apache 13 BackendOpen b apache 127.0.0.1 47665 127.0.0.1 8000 13 TxRequest b GET 13 TxURL b /api/v1/events/?format=json 13 TxProtocol b HTTP/1.1 13 […]

只有Django在mod_wsgi的存在下工作,PHP不工作

我在一个rackspace服务器上使用apache2和MySQL的PHP​​,它是非托pipe的cluoud托pipe。 我正在使用虚拟主机托pipe多个网站。 现在我想使用它的Django。 一个网站需要django,所以我已经安装了django和mod_wsgi使用apt-get install 。 然后我在httpd.conf中写了下面几行 WSGIScriptAlias / /var/www/djangosite/pyproject/mysite/mysite/wsgi.py WSGIPythonPath /var/www/djangosite/pyproject/mysite/ <Directory /var/www/djangosite/pyproject/mysite/mysite/> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> 但是,只有django在所有网站上工作,只有该特定的项目出现在所有网站上。 所以如果我只想要它为特定的网站工作,我需要什么? 以便其他网站可以在以前使用PHP工作时工作。 我需要设置服务器名称等在哪里?

mod_wsgi:共享虚拟主机之间的守护进程

我有许多站点都使用相同的5 Django应用程序(本地设置),托pipe在Apache上。 目前每个网站的应用程序都有自己的configuration如下: WSGIDaemonProcess api_example threads=15 maximum-requests=2000 WSGIProcessGroup api_example WSGIScriptAlias /api /var/www/sites/example/api/site.wsgi 是否有可能在虚拟主机之间共享守护进程,但保持本地设置处于活动状态? 我的目标是节省内存,并减less启动服务请求的Apache进程的数量(其中几个应用程序是仅偶尔使用的pipe理/支持控制台)。 – 编辑 – 正如Graham Dumpleton在这里提出的: mod_wsgi守护进程模式 – WSGIDaemonProcess每个虚拟主机configuration? ,应该有可能“超越先前虚拟主机中的守护进程定义,因为它具有相同的服务器名称”。 请注意,正如Graham指出的那样,WSGIApplicationGroup指令必须从默认值调整为%{GLOBAL}或%{ENV:variable}。 我不确定如何在虚拟主机中“使用”服务器级别的声明。 是否有可能使用服务器级守护进程与本地设置?

Django的WSGI应用程序在一个子目录中?

最近,我想把我的一个WSGI应用程序放到一个子目录中,这样其他包含各种脚本的目录就像以前一样工作。 为了做到这一点,我在全局命名空间的httpd.conf中添加了下面的指令(也试图把它放在VirtualHost ,它给出了相同的效果): WSGIScriptAlias /hello/ /var/www/hello/hello.wsgi 然后,我跑了django-admin startproject hello 。 重新加载Apacheconfiguration后,我可以确认http://localhost/hello/指向一个Django的“欢迎”屏幕。 然后,我编辑了hello/urls.py在urlpatterns元组中添加下面一行: url(r'^hello/', 'hello.views.home'), 接下来,我创build了具有以下内容的hello / views.py: from django.http import HttpResponse def hello(request): return HttpResponse("Hello world") 不幸的是,当我尝试访问http://localhost/hello/hello ,我得到一个标准的Apache 404消息,并在错误日志中input以下内容: [Mon Dec 23 19:49:44 2013] [error] [client 31.182.131.38] Target WSGI script not found or unable to stat: /var/www/hello/hello.wsgihello 注意hello.wsgihello 。 第二个hello是URL中/hello/之后出现的文本。 对于http://localhost/hello/unknown ,这将是hello.wsgiunknown 。 这里是我的hello.wsgi : […]

virtualenv无法映射共享对象的段:权限被拒绝

当SELinx处于permissive ,Django webapp运行正常,没有警报。 一旦SELinux设置为强制执行,Apache错误日志中将出现以下错误,但不会向audit.loglogging警报。 [wsgi:error] import psycopg2 as Database [wsgi:error] File "/mnt/data/venv/app/lib/python3.4/site-packages/psycopg2/__init__.py", line 50, in <module> [wsgi:error] from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID [wsgi:error] ImportError: /venv/app/lib/python3.4/site-packages/psycopg2/_psycopg.cpython-34m.so: failed to map segment from shared object: Permission denied 系统运行CentOS 7,Apache httpd 2.4 2.4.6(已安装rpm),Python 3.4.2(已安装源代码),并安装了pip:mod_wsgi 4.4.5,virtualenv 12.0.5,psycopg2 2.5.4和Django 1.7。 2。 Django没有logging任何内容。 virtualenv目录的当前文件上下文types是httpd_sys_content_t 。

将Django应用程序部署为WordPress子页面(在子url),mod-wsgi

我有一个WordPress的博客,假设它的地址就像yakblog.org ,它是一个安装在Ubuntu 12.04服务器上的Wordpress博客。 现在,我想运行一个Django应用程序作为我的博客的子页面之一,所以我可以像这样访问它: yakblog.org/testproject 。 这是确切的情况: https : //community.webfaction.com/questions/17758/wordpress-on-root-domain-django-in-subdirectory (虽然我不使用webfaction)。 此外,我试过这里给出的解决scheme: https : //stackoverflow.com/questions/26013379/run-django-project-inside-wordpress-on-suburl-of-wordpress-using-apache-and-mod ,但后来我有一个WordPress的消息: This is somewhat embarrassing, isn't it? 但是,我遇到了一些这样做的问题,我不确定是否可以用我的设置。 好吧,我做了以下工作来实现我所需要的: 在/var/www/yak/public_html创build一个Django项目,所以在/var/www/yak/public_html我有这样的结构: 然后,在我的/etc/apache2/apache2.conf文件中添加一行WSGIPythonPath /var/www/yak/public_html/testproject 这是我的虚拟主机代码: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName yakblog.org/testproject ServerAlias www.yakblog.org/testproject #RedirectPermanent / http://yakblog.org/testproject WSGIScriptAlias /testproject /var/www/yak/public_html/testproject/testproject/wsgi.py DocumentRoot /var/www/yak/public_html/testproject/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/yak/public_html/testproject/> Options Indexes […]

在Amazon Linux AMI上将apache MPM prefork更改为worker

我的项目默认在Prefork MPM下运行。 Rigth现在我有一些放缓的问题,我的网站有超时错误。 searchdifferents foroums我看到这是推荐使用工人模块,我看到不同的方式来改变它,但最终没有任何与我的项目工作。 我用这个脚本在apache2.2下运行我的项目 python manage.py runmodwsgi –setup-only –host = 0.0.0.0 –port = 8000 –reload-on-changes –server-root = / mod_wsgi / 这个脚本在文件夹“mod_wsgi”中创build我的apachectl在文件夹中,我使用“./apachectl -V”来查看在项目中工作的模块,看到这个 服务器版本:Apache / 2.2.34(Unix)服务器内置:Nov 1 2017 18:47:16服务器的模块魔术数字:20051115:43服务器加载:APR 1.5.1,APR-Util 1.4.1编译使用:APR 1.5。 1,APR-Util 1.4.1体系结构:64位服务器MPM:Prefork线程:无分叉:是(可变进程数)使用…. -D编译的服务器APACHE_MPM_DIR =“server / mpm / prefork” -D APR_HAS_SENDFILE – D APR_HAS_MMAP … 所以,要从prefork MPM更改为Worker,我试着在这个path/ etc / sysconfig / httpd文件中取消注释行:HTTPD = […]