apache使用fastcgi配置python和php
来源:互联网 发布:数据库第六章课后答案 编辑:程序博客网 时间:2024/05/17 06:10
- centos安装php: yum install php php-devel
- centos自带apache2,查看apache版本
rpm -qa | grep httpd
,
安装apache工具(apxs等)yum install httpd-devel
httpd -l httpd -M 列出apache安装的扩展模块 - 如果要外网访问,需要关闭防火墙:
/etc/init.d/iptables stop # 或者是centos7:systemctl stop firewalld.service # 停止systemctl disable firewalld.service # 禁用之前的版本:service iptables stop # 停止chkconfig iptables off # 禁用
关闭selinux. 查看selinux状态使用/usr/sbin/sestatus -v
如果SELinuxstatus参数为enable则为开启状态
暂时关闭(不用重启)可以用 setenforce 0
4. python安装flup,apache安装mod_fastcgi
5. apache配置:
ServerName localhost:80 # 第275行左右,要修改# 最后面加上这些LoadModule rewrite_module modules/mod_rewrite.soLoadModule fastcgi_module modules/mod_fastcgi.soFastCGIExternalServer /home/qiu/workspace/p1/p1.fcgi -host 127.0.0.1:8080NAMEVirtualHost 192.168.43.128:80<VirtualHost 192.168.43.128:80> DocumentRoot /home/qiu/workspace/p1 ServerAdmin xiaoqiu206@163.com ServerName python.test.com Alias /static /home/qiu/workspace/p1/static RewriteEngine On ErrorLog "/home/qiu/workspace/p1/log" RewriteRule ^/(static.*)$ /$1 [QSA,L,PT] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ /p1.fcgi/$1 [L]</VirtualHost><VirtualHost 192.168.43.128:80> ##### php项目的配置 ServerAdmin example1@126.com DocumentRoot "/home/qiu/Documents/php" ServerName php.test.com ErrorLog "logs/ce.err" CustomLog "logs/ce.access" common <Directory "/your/path/php"> Options FollowSymLinks AllowOverride All Order deny,allow Allow from all </Directory></VirtualHost>
注意点:文件必须可读
python启动方式: python manage.py runfcgi protocol=fcgi method=threaded host=127.0.0.1 port=8080 deamonize=false
- 使用apache和gunicorn.
使用apache的反向代理
apache配置:
<VirtualHost 192.168.43.128:80> # python gunicorn ServerAdmin xiaoqiu206@163.com ServerName gunicorn.test.com ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /static/ ! ProxyPass / http://127.0.0.1:8888/ ProxyPassReverse / http://127.0.0.1:8888/ # 有的教程加上了这2行 # ProxyPreserveHost On # ProxyErrorOverride Off Alias /static/ /usr/local/python/lib/python2.7/site-packages/django/contrib/admin/static/ <Directory "/static/"> Order allow,deny Options Indexes Allow from all IndexOptions FancyIndexing </Directory></VirtualHost>
gunicorn启动方式:
进入到工程目录下,gunicorn p1.wsgi:application -b 127.0.0.1:8888
或者 gunicorn -k egg:meinheld#gunicorn_worker p1.wsgi:application -b 127.0.0.1:8888
或者 gunicorn -k gevent p1.wsgi:application -b 127.0.0.1:8888
全局的NAMEVirtualHost 192.168.43.128:80可以改写为NAMEVirtualHost *:80然后VirtualHost里的IP:PORT也都可以改成VirtualHost *:80
0 0
- apache使用fastcgi配置python和php
- fastcgi+apache+php的配置
- Apache 配置------FastCGI方式使用PHP(包含:linux下编译安装fmod_fcgid,配置apache以支持FastCGI)
- Apache + MySQL + PHP + FastCGI 配置(上)
- Apache + MySQL + PHP + FastCGI 配置(中)
- Apache + MySQL + PHP + FastCGI 配置(下)
- Apache+FastCGI+PHP配置详解(Windows)
- apache下php配置fastcgi代替mod_php
- apache中配置php支持模块模式、cgi模式和fastcgi模式的实验
- apache中配置php支持模块模式、cgi模式和fastcgi模式的实验
- apache中配置php支持模块模式、cgi模式和fastcgi模式的实验
- linux后台服务器开发环境部署配置和验证(nginx+apache+php-fpm+FASTCGI(C/C++))
- apache中配置php支持模块模式、cgi模式和fastcgi模式
- 使用fastcgi后,配置PHP文件
- php使用FastCGI 配置url重写问题
- windows下apache+fastCGI+PHP的安装与配置小计
- 解决apache+fastcgi+php配置好不能访问的问题
- apache 配置php mod_php cgi fastcgi访问方式
- 35.scala编程思想笔记——基于case类的模式匹配
- 用正则匹配出一段文章中的img标签
- 36.scala编程思想笔记——简洁性
- 使用spark访问elasticsearch的数据
- Python安装easy_install报错的处理方式
- apache使用fastcgi配置python和php
- 37.scala编程思想笔记——风格拾遗
- VMware+CentOS+Apache+php+python+Django+gunicorn配置
- .NET学习(十一)QA
- 安装apache httpd2.4
- 控制情绪和欲望,宁静致远
- .bashrc 修改
- MongoDB入门
- Fragemnt