标签:alt fas ring ibm 添加 pre static 安装nginx 指定
系统版本:centos7 64位
PHP版本:PHP 7.0.21
Nginx版本:1.8.1
MySQL版本:5.5.17
注:1.所有安装都必须放在 /usr/local/src文件夹下
2.添加PHP临时环境变量方法
export PATH=$PATH:/usr/local/php/bin/
此环境变量只可以在当前窗口有效,关闭或者其它窗口都将失效
systemctl stop firewalld.service
service iptables stop
yum -y install gcc automake autoconf libtool make gcc-c++ glibc libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel pcre pcre-devel libmcrypt libmcrypt-devel cmake
nginx版本: wget http://nginx.org/download/nginx-1.8.1.tar.gz /usr/local/src
cd /usr/local/src
tar xf nginx-1.8.1.tar.gz
cd nginx-1.8.1
创建用户www和用户组www
groupadd www
useradd -g www www
./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module
make && make install
nginx安装成功,启动报以下错误表示端口被占用,使用lsof -i:80查看谁占用了80端口并用kill -9 进程号杀死
启动nginx:
/usr/local/nginx/sbin/nginx
php版本:php-7.0.21.tar.gz
tar -zxvf php-7.0.21.tar.gz
cd php-7.0.21/
./configure --prefix=/usr/local/php --with-curl --with-bz2 --with-zlib --with-mhash --with-pcre-regex --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-openssl --with-pdo-mysql --with-libxml-dir --with-freetype-dir --with-iconv --enable-opcache --enable-bcmath --enable-ftp --enable-shmop --enable-fpm --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-calendar --enable-zip --enable-mbstring --enable-pdo
make && make install
出现图片内容表示PHP安装成功!
// 配置php-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
//修改php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
将;pid = run/php-fpm.pid 前面的分号删掉
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /usr/local/src/php-7.0.21/php.ini-production /usr/local/php/lib/php.ini
//拷贝php-fpm脚本至/etc/init.d目录
cp /usr/local/src/php-7.0.21/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
//设置权限并启动php-fpm:
chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
// php-fpm以服务的方式启动、停止和重启:
service php-fpm start
service php-fpm stop
service php-fpm reload
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重启nginx /usr/sbin/nginx -s reload
启动nginx /usr/sbin/nginx
停止nginx /usr/sbin/nginx -s stop
标签:alt fas ring ibm 添加 pre static 安装nginx 指定
原文地址:http://www.cnblogs.com/caiji/p/7424400.html