1、先安装openssl ,以及openssl-devel
2、python27编译
./configure --prefix=/usr/local/python27 --enable-shared --with-ssl --with-zlib

make
make install
a、重命名 现有python 为python2.66
b、设置/usr/bin/python 软连接到python27
ln -s /usr/local/python27/bin/python /usr/bin/python

c、libpython2.7.so.1.0的错误时的 解决办法:
vi /etc/ld.so.conf 添加/usr/local/python27/lib/
/sbin/ldconfig
/sbin/ldconfig -v

3、安装apache
源代码安装2.4
3.1、安装apr-1.5.1
./configure --prefix=/usr/local/apr
make
make install
3.2、安装apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make
make install

3.2、安装pcre-8.36
./configure --prefix=/usr/local/pcre
make
make install

3.3、安装openssl
./config --prefix=/usr/local/openssl
make
make install

3.4 缺少expat-2.0.1.tar.gz
下载并安装
./configure
make
make install

3.5 安装httpd-2.4.12
./configure --prefix=/usr/local/apache2 --with-ssl=/usr/local/openssl/ssl/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
make
make install

3.6 配置通过/etc/init.d/httpd 启动
a、修改进程的ID号存储的路径
vim /usr/local/apache2/conf/httpd.conf
添加如下一条:
PidFile /var/run/httpd/httpd.pid
b、修改 启动进程的用户和组
User apache
Group apache

c、修改apache可执行文件的路径
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
d、启动时报错 说找不到 /usr/local/apache/conf/httpd.conf
软连接一下/usr/local/apache2 目录到 /usr/local/apache
ln -s /usr/local/apache2 /usr/local/apache


a、禁止访问问题
下述是 Apache 2.2 VS Apache 2.4 的設定檔有哪些變更差異
Deny All
2.2 configuration:
Order deny,allow
Deny from all
2.4 configuration:
Require all denied
Allow All
2.2 configuration:
Order allow,deny
Allow from all
2.4 configuration:
Require all granted
Allow Host
2.2 configuration:
Order Deny,Allow
Deny from all
Allow from example.org
2.4 configuration:
Require host example.org
Directory 用 Require all granted

<Directory /var/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

FilesMatch 維持用 Order

<FilesMatch ".+\.PHPs$">
SetHandler application/x-httpd-PHP-source
Order Deny,Allow
Allow from all
</FilesMatch>


注释掉:
#<Directory />
# AllowOverride none
# Require all denied
#</Directory>


WsgiSocketPrefix run/wsgi

<VirtualHost *:8000>
DocumentRoot /var/www/test
ErrorLog logs/test-error_log
CustomLog logs/test-access_log common
Alias /media/ /var/www/test/media/
Alias /static/ /var/www/test/static/
LimitRequestLine 65535
WsgiDaemonProcess test processes=1 threads=25 display-name=%{GROUP}
WsgiProcessGroup test
WsgiChunkedRequest On
WsgiScriptAlias / /var/www/test/mysite/wsgi.py
<Directory "/var/www/test">
Options -Indexes +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

b、Couldn't bind unix domain socket '/usr/local/apache/run/wsgi.23685.0.1.sock'
是因为缺少run目录
cd /usr/local/apache/
创建run目录


c、/home/apache/.python-eggs,change the cache directory by setting the PYTHON_EGG_CACHE environment
创建 /home/apache/.python-eggs目录


d、修改日志目录
ErrorLog "/var/log/httpd/error_log"
CustomLog "/var/log/httpd/access_log" common

e、安装完报不能引入 django1.7.10+pthon2.7.9
==> /var/log/httpd/dx_anhui_hipi_game-error_log <==
[Thu Oct 08 22:01:56.744233 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] mod_wsgi (pid=5497): Target Wsgi script '/var/www/dx_anhui_hipi_game/mysite/wsgi.py' cannot be loaded as Python module.
[Thu Oct 08 22:01:56.744250 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] mod_wsgi (pid=5497): Exception occurred processing Wsgi script '/var/www/dx_anhui_hipi_game/mysite/wsgi.py'.
[Thu Oct 08 22:01:56.744276 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] Traceback (most recent call last):
[Thu Oct 08 22:01:56.744303 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] File "/var/www/dx_anhui_hipi_game/mysite/wsgi.py",line 16,in <module>
[Thu Oct 08 22:01:56.744337 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] application = get_wsgi_application()
[Thu Oct 08 22:01:56.744407 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] File "/usr/local/python27/lib/python2.7/site-packages/django-1.7.10-py2.7.egg/django/core/wsgi.py",line 14,in get_wsgi_application
[Thu Oct 08 22:01:56.744439 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] django.setup()
[Thu Oct 08 22:01:56.744459 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] File "/usr/local/python27/lib/python2.7/site-packages/django-1.7.10-py2.7.egg/django/__init__.py",line 21,in setup
[Thu Oct 08 22:01:56.744488 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] apps.populate(settings.INSTALLED_APPS)
[Thu Oct 08 22:01:56.744507 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] File "/usr/local/python27/lib/python2.7/site-packages/django-1.7.10-py2.7.egg/django/apps/registry.py",line 78,in populate
[Thu Oct 08 22:01:56.744538 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] raise RuntimeError("populate() isn't reentrant")
[Thu Oct 08 22:01:56.744565 2015] [:error] [pid 5497:tid 140342038816512] [remote 58.60.159.119:30200] RuntimeError: populate() isn't reentrant

[Thu Oct 08 22:42:27.438088 2015] [:error] [pid 5268:tid 139970325456640]
[Thu Oct 08 22:42:27.438091 2015] [:error] [pid 5268:tid 139970325456640] The Python egg cache directory is currently set to:
[Thu Oct 08 22:42:27.438094 2015] [:error] [pid 5268:tid 139970325456640]
[Thu Oct 08 22:42:27.438097 2015] [:error] [pid 5268:tid 139970325456640] /sbin/.python-eggs
[Thu Oct 08 22:42:27.438101 2015] [:error] [pid 5268:tid 139970325456640]
[Thu Oct 08 22:42:27.438105 2015] [:error] [pid 5268:tid 139970325456640] Perhaps your account does not have write access to this directory? You can
[Thu Oct 08 22:42:27.438109 2015] [:error] [pid 5268:tid 139970325456640] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Thu Oct 08 22:42:27.438113 2015] [:error] [pid 5268:tid 139970325456640] variable to point to an accessible directory.
[Thu Oct 08 22:42:27.438116 2015] [:error] [pid 5268:tid 139970325456640]
[Thu Oct 08 22:42:29.941013 2015] [:error] [pid 5268:tid 139970325456640] [remote 58.60.159.119:44288] mod_wsgi (pid=5268): Target Wsgi script '/var/www/dx_anhui_hipi_game/mysite/wsgi.py' does not contain Wsgi application 'application'.

应该是要设置下环境变量PYTHON_EGG_CACHE=

wsgi中修改application

import time
import traceback
import signal

try:
application = get_wsgi_application()
print 'Wsgi without exception'
except Exception:
print 'handling Wsgi exception'
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
os.kill(os.getpid(),signal.SIGINT)
time.sleep(2.5)

重启 在查看apache日志
修改完相应的错误后,还原回来就OK了。

f、修改apache默认创建的权限以及删除的字符编码
vim /etc/sysconfig/httpd

umask 002

export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'




4、编译mod_wsgi
python重新安装之后,mod_wsgi需要重新装
cd mod_wsgi-3.4/
apxs的为apache安装后的目录
./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/bin/python

make
make install

apache2.4
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/python

make clean
make
make install

LoadModule wsgi_module modules/mod_wsgi.so

有时候,有些包是已经编译过的,要重新编译必须 make clean 否则会导致你怎么安装都安装不上你想要的包

5、mod_wsgi的配置
import sys
import os
p = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0,os.path.split(p)[0])
os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


6、安装subversion svn客户端

7、安装pysvn

8、安装PIL插件,如果遇到下面错误的处理方法

不要去官方下载pil ,安装 Pillow-2.0.0.zip 就OK了,这个插件包封装了

centos64-python27-mod_wsgi-apache2.4的更多相关文章

  1. ios – 200在xcode 7中生成DSMM警告

    解决方法我有同样的问题.Facebook表示他们已经意识到这一点并且不是高优先级,因为它不会影响应用程序.我回退到4.7.1警告问题不再存在.我不认为它会被拒绝但不能确定.

  2. xamarin.ios – Facebook iOS SDK:应用程序在启动时找不到“找不到符号:_ACFacebookAppIdKey.”仅在iOS 5中崩溃

    解决方法这是一个已修复的knownbug.目前唯一已知的解决方法是使用较旧版本的FacebookSDK.

  3. osx – 无法创建目录/ var / teamsserver

    OpenSSH_6.2p2,OSSLShim0.9.8r8Dec2011debug1:Readingconfigurationdata/etc/ssh_configdebug1:/etc/ssh_configline20:Applyingoptionsfor*debug1:Connectingto1.2.3.4[1.2.3.4]portPORT.debug1:Connectionestablished.Couldnotcreatedirectory‘/var/teamsserver/.ssh’.debug

  4. ios – 如何在Xcode 4.5中完成代码签名

    解决方法事实证明,从AppStore升级XCode并不会自动升级所有内容.转到首选项/下载,并确保安装最新的命令行工具.

  5. xcode7 – 谁在创建文件“/private/var/tmp/Untitled-*.uicatalog”?

    我正在调查为什么TeamCity构建代理程序用完了磁盘,并且在/private/var/tmp中找到了超过11,000个文件,它们都以Untitled-.uicatalog行命名.每个文件至少0.6MB.总磁盘占用空间约为4GB.这些文件可以追溯到几个月,所以他们能够重新启动.谁在创造他们?Xcode在编译至少有一个图像的xcassets目录时创建这些目录.我可以删除它们吗?

  6. ios – Client.ipa不包含文件

    从过去的几天开始,我就把这头发错了.当我尝试提交基于cordova的iOS应用程序时,我收到一个错误,即符号工具失败.这就是我在日志中的内容:以下是尝试提交到应用商店时所述错误的屏幕截图:请帮忙.解决方法我有同样的错误,因为应用程序包中错误地包含了几个静态库(libXXX.a).它们显示在主.App下的最终上传确认框(列出权利和证书)中.我的解决方案是从项目中删除对这些静态库的所有引用,在链接器标

  7. IOs Cordova长按显示文本选择放大镜即使禁用文本选择,如何删除?

    是否有任何可能导致此问题的插件?任何帮助深表感谢.Cordova插件:>com.mbppower.camerapreview>cordova-plugin-statusbar>cordova-plugin-whitelist>离子插件键盘>org.apache.cordova.camera>org.apache.cordova.console>org.apache.cordova.device>org.apache.cordova.dialogs>org.apache.cordova.file>org.a

  8. ios – 如何获得.ipa文件路径

    我的应用程序包含敏感数据,所以我想为.ipa文件生成哈希键,是否可以这样做?

  9. ios – 在设备上运行时Swift应用程序崩溃 – dyld:未加载库:@ rpath / libswiftCore.dylib

    我是ios/xcode世界的新手,并尝试在运行iOSv8.0.2的iphone5上测试一个简单的Swift应用程序.该应用程序在xcode(版本6.1(6A1052d))中成功构建,但当它尝试在iphone上运行时,它崩溃并出现以下错误:我已经尝试过大多数建议,这些建议帮助了遇到此错误的其他人,但却没有运气.使用其他团队成员的构建环境构建时,相同的应用程序工作正常.我比较了构建设置,发现它们是相同

  10. 使用Swift作为Glance后端存储

    原文链接http://thornelabs.net/2014/08/03/use-openstack-swift-as-a-backend-store-for-glance.htmlBydefault,OpenStackGlancesavesimagesandOpenStackInstancesnapshotsonthelocalfilesystemin/var/lib/glance/images

随机推荐

  1. 在airgapped(离线)CentOS 6系统上安装yum软件包

    我有一个CentOS6系统,出于安全考虑,它已经被空气泄漏.它可能从未连接到互联网,如果有,它很长时间没有更新.我想将所有.rpm软件包放在一个驱动器上,这样它们就可以脱机安装而无需查询互联网.但是,我在测试VM上遇到的问题是,即使指定了本地路径,yum仍然会挂起并尝试从在线存储库进行更新.另外,有没有办法使用yum-utils/yumdownloader轻松获取该包的所有依赖项和所有依赖项?目前

  2. centos – 命名在日志旋转后停止记录到rsyslog

    CentOS6.2,绑定9.7.3,rsyslog4.6.2我最近设置了一个服务器,我注意到在日志轮换后,named已停止记录到/var/log/messages.我认为这很奇怪,因为所有日志记录都是通过rsyslog进行的,并且named不会直接写入日志文件.这更奇怪,因为我在更新区域文件后命名了HUPed,但它仍然没有记录.在我停止并重新启动命名后,记录恢复.这里发生了什么?

  3. centos – 显示错误的磁盘大小

    对于其中一个磁盘,Df-h在我的服务器上显示错误的空白区域:Cpanel表明它只有34GB免费,但还有更多.几分钟前,我删除了超过80GB的日志文件.所以,我确信它完全错了.fdisk-l/dev/sda2也显示错误:如果没有格式化,我该怎么做才能解决这个问题?并且打开文件描述符就是它需要使用才能做到这一点.所以…使用“lsof”并查找已删除的文件.重新启动写入日志文件的服务,你很可能会看到空间可用.

  4. 如何在centos 6.9上安装docker-ce 17?

    我目前正在尝试在centOS6.9服务器上安装docker-ce17,但是,当运行yuminstalldocker-ce时,我收到以下错误:如果我用跳过的标志运行它我仍然得到相同的消息,有没有人知道这方面的方法?

  5. centos – 闲置工作站的异常负载平均值

    我有一个新的工作站,具有不寻常的高负载平均值.机器规格是:>至强cpu>256GB的RAM>4x512GBSSD连接到LSI2108RAID控制器我从livecd安装了CentOS6.564位,配置了分区,网络,用户/组,并安装了一些软件,如开发工具和MATLAB.在启动几分钟后,工作站负载平均值的值介于0.5到0.9之间.但它没有做任何事情.因此我无法理解为什么负载平均值如此之高.你能帮我诊断一下这个问题吗?

  6. centos – Cryptsetup luks – 检查内核是否支持aes-xts-plain64密码

    我在CentOS5上使用cryptsetupluks加密加密了一堆硬盘.一切都很好,直到我将系统升级到CentOS6.现在我再也无法安装磁盘了.使用我的关键短语装载:我收到此错误:在/var/log/messages中:有关如何装载的任何想法?找到解决方案问题是驱动器使用大约512个字符长的交互式关键短语加密.出于某种原因,CentOS6中的新内核模块在由旧版本创建时无法正确读取512个字符的加密密钥.似乎只会影响内核或cryptsetup的不同版本,因为在同一系统上创建和打开时,512字符的密钥将起作用

  7. centos – 大量ssh登录尝试

    22个我今天登录CentOS盒找到以下内容这是过去3天内的11次登录尝试.WTF?请注意,这是我从我的提供商处获得的全新IP,该盒子是全新的.我还没有发布任何关于此框的内容.为什么我会进行如此大量的登录尝试?是某种IP/端口扫描?基本上有4名匪徒,其中2名来自中国,1名来自香港,1名来自Verizon.这只发生在SSH上.HTTP上没有问题.我应该将罪魁祸首子网路由吗?你们有什么建议?

  8. centos – kswap使用100%的CPU,即使有100GB的RAM也可用

    >Linux内核是否应该足够智能,只需从内存中清除旧缓存页而不是启动kswap?

  9. centos – Azure将VM从A2 / 3调整为DS2 v2

    我正在尝试调整前一段时间创建的几个AzureVM,从基本的A3和标准A3到标准的DS2v2.我似乎没有能力调整到这个大小的VM.必须从头开始重建服务器会有点痛苦.如果它有所不同我在VM中运行CentOS,每个都有一个带有应用程序和操作系统的磁盘.任何人都可以告诉我是否可以在不删除磁盘的情况下删除VM,创建新VM然后将磁盘附加到新VM?

  10. centos – 广泛使用RAM时服务器计算速度减慢

    我在非常具体的情况下遇到服务器速度下降的问题.事实是:>1)我使用计算应用WRF>2)我使用双XeonE5-2620v3和128GBRAM(NUMA架构–可能与问题有关!

返回
顶部