您正在查看: php 分类下的文章

Typecho Nginx服务器无法登录后台,点击前台链接或者后台登录时出现404, not found

一般的出现这种情况时,nginx.conf里的的location设置都是类似这样

location ~ .*\.php$

要支持pathinfo,要改成

location ~ .*\.php(\/.*)*$

Typecho nginx服务器无法实现伪静态化,在后台设置不成功

这主要是nginx的rewrite没有设置导致的

在nginx.conf里找到网站的server配置段,一般我们推荐如下的配置

 server {
    listen          80;
    server_name     blog.siddim.com;
    root            /data/htdocs/www/;
    index           index.html index.htm index.php;

    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php$1 last;
    }

    location ~ .*\.php(\/.*)*$ {
        include fastcgi.conf;
        fastcgi_pass  127.0.0.1:9000;
    }

}

nginx配置php

location ~ \.php$ {
        root           html;//要访问php的根目录
        fastcgi_pass   127.0.0.1:9000; //php-fpm.conf配的IP和端口
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

linux下编译源码前需要yum的头文件

yum install make apr* autoconf automake curl curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat*  cpp glibc libgomp libstdc++-devel keyutils-libs-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch