服务器下环境配置

//php配置
yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y

tar -xjf php-5.6.2.tar.bz2

cd php-5.6.2

./configure --prefix=/usr/local/php-5.6.2 --with-config-file-path=/usr/local/php-5.6.2/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64


make
make install

cp php.ini-production /usr/local/php-5.6.2/etc/php.ini
cp /usr/local/php-5.6.2/etc/php-fpm.conf.default /usr/local/php-5.6.2/etc/php-fpm.conf


/usr/local/php-5.6.2/sbin/php-fpm


执行以上命令,如果没报错一般情况下表示启动正常,如果不放心,也可以通过端口判断是PHP否启动
# netstat -lnt | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
php配置
 server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /data/www/;
            index  index.html index.htm index.php;
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }
        }

        # error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
       

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
         location ~ .php$ {
            root          /data/www/;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
          }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    server {
       listen       8000;
       listen       localhost;
       server_name  somename  alias  another.alias;

       location / {
           root   /home/www/;
           index  index.html index.htm;
       }
    }
nginx配置php
原文地址:https://www.cnblogs.com/chenlw/p/14000871.html