nginx php 安装配置

一、nginx安装配置

依赖包

yum install -y gcc-c++;
yum install -y pcre pcre-devel;
yum install -y zlib zlib-devel;
yum install -y openssl openssl-devel;

 

wget http://nginx.org/download/nginx-1.14.0.tar.gz

groupadd -g 888 www;
useradd -g www www -s /sbin/nologin -u 888;

tar xvf nginx-1.13.6.tar.gz;
cd nginx-1.13.6;
groupadd www;
useradd -g www www -s /sbin/nologin;
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-stream_ssl_module --with-http_ssl_module --with-stream;
make && make install;

 

nginx 配置文件

ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #指定SSL服务器端支持的协议版本
ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; #指定加密算法
ssl_prefer_server_ciphers on; #在使用SSLv3和TLS协议时指定服务器的加密算法要优先于客户端的加密算法

转发php配置

location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

二、php安装配置

 

yum -y install openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel readline-devel libicu-devel

wget http://au1.php.net/distributions/php-5.6.22.tar.gz

tar zxvf php-5.6.22.tar.gz

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz
./configure --prefix=/usr/local/libmcrypt
make && make install

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-zlib-dir=/usr/local/zlib --with-mcrypt=/usr/local/libmcrypt --with-libxml-dir=/usr/local/libxml2/ --with-iconv-dir=/usr/local/libiconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring=all --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-shared --with-gd
make && make install

配置文件

cp /soft/php-5.6.22/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

cp /soft/php-5.6.22/sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

cp /soft/php-5.6.22/php.ini-development /usr/local/php/etc/php.ini

chmod 777 /etc/init.d/php-fpm

ln -s /usr/local/php/bin/php /usr/bin/php 

//php.ini中
short_open_tag = On

 

chmod -R 777 html

posted @ 2018-07-23 11:18  codeforu2  阅读(272)  评论(0编辑  收藏  举报