Home > php教程 > php手册 > nginx+apache+php-fpm的配置

nginx+apache+php-fpm的配置

WBOY
Release: 2016-06-06 20:07:55
Original
977 people have browsed it

准备工作,先安装好nginx和php,建议大家去看看 www.phpcxz.com 里面有篇详细的安装文章.我们还是详细讲配置吧 首先配置apache.确保apache有mod_fastcgi.so模块 #配置apache以php-cgi方式跑phpScriptAlias /fcgi-bin/ "/usr/local/webserver/php/bin/" 这是p

   准备工作,先安装好nginx和php,建议大家去看看www.phpcxz.com里面有篇详细的安装文章.我们还是详细讲配置吧

    首先配置apache.确保apache有mod_fastcgi.so模块

#配置apache以php-cgi方式跑php
ScriptAlias /fcgi-bin/ "/usr/local/webserver/php/bin/" 这是php-bin的路径
AddHandler php-fastcgi .php 
Action php-fastcgi /fcgi-bin/php-cgi
AddType application/x-httpd-php .php 
Copy after login
最后开始配置nginx实现反向代理,这里重点写server的配置
server {
    listen          80; 
    server_name     localhost;
    access_log      /var/log/nginx/access.log;
    root  /var/www;
    error_page  404   /40x.html;
    location = /40x.html{
        root  html/404;
    }   
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }   
    location / { 
        index   index.php index.html index.htm;
    }   
    location ~ \.php$ {
        proxy_pass    http://127.0.0.1:8080;#后端交给apache
Copy after login
        #其他的配置     }   
    #图片、CSS、JS交给Nginx处理,缓存到本地
    location ~* \.(jpg|jpeg|gif|png)$ {
        access_log  off;
        expires  30d;
    }
}
Copy after login
这样配置就好了。 我先记下这些,供以后查看.
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template