PHP编译安装
下载php到/usr/local/src目录下
[root@lnmp ~]# cd /usr/local/src/
[root@lnmp src]# wget http://mirrors.sohu.com/php/php-5.4.37.tar.gz
解压php:
[root@lnmp src]# tar -zxvf php-5.4.37.tar.gz
创建相关账号:
[root@lnmp src]# useradd -s /sbin/nologin php-fpm
安装扩展源
[root@lnmp php-5.4.37]# rpm -ivh "http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm"
安装php编译环境
[root@lnmp php-5.4.37]# yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel libjpeg-devel
配置变异参数:
[root@lnmp php-5.4.37]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6 --with-pear --with-curl --with-openssl
编译php:
[root@lnmp php-5.4.37]# make
安装php:
[root@lnmp php-5.4.37]# make install
复制配置文件:
[root@lnmp php-5.4.37]#cp php.ini-production /usr/local/php/etc/php.ini
复制启动脚本:
[root@lnmp php-5.4.37]#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@lnmp php-5.4.37]#chmod 755 /etc/init.d/php-fpm
重命名配置文件:
[root@lnmp php-5.4.37]#cd /usr/local/php/etc
[root@lnmp etc]#mv php-fpm.conf.default php-fpm.conf
启动:
[root@lnmp php-5.4.37]# chkconfig --add php-fpm
[root@lnmp php-5.4.37]# chkconfig php-fpm on
[root@lnmp php-5.4.37]# service php-fpm start
nginx编译安装
解压nginx安装包
tar -zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
安装编译环境所需插件
yum install -y libtool-ltdl-devel pcre-devel
配置编译环境
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
编译安装
make && make install
创建启动脚本而
vim /etc/init.d/nginx
#!/bin/bash# chkconfig: - 30 21# description: http service.# Source Function Library. /etc/init.d/functions# Nginx SettingsNGINX_SBIN="/usr/local/nginx/sbin/nginx"NGINX_CONF="/usr/local/nginx/conf/nginx.conf"NGINX_PID="/usr/local/nginx/logs/nginx.pid"RETVAL=0prog="Nginx"start() { echo -n $"Starting $prog: " mkdir -p /dev/shm/nginx_temp daemon $NGINX_SBIN -c $NGINX_CONF RETVAL=$? echo return $RETVAL}stop() { echo -n $"Stopping $prog: " killproc -p $NGINX_PID $NGINX_SBIN -TERM rm -rf /dev/shm/nginx_temp RETVAL=$? echo return $RETVAL}reload(){ echo -n $"Reloading $prog: " killproc -p $NGINX_PID $NGINX_SBIN -HUP RETVAL=$? echo return $RETVAL}restart(){ stop start}configtest(){ $NGINX_SBIN -c $NGINX_CONF -t return 0}case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; configtest) configtest ;; *) echo $"Usage: $0 {start|stop|reload|restart|configtest}" RETVAL=1esacexit $RETVAL
为启动脚本而赋予755权限
chmod 755 /etc/init.d/nginx
启动nginx
chkconfig --add nginx
chkconfig nginx on
service nginx start
/usr/local/nginx/sbin/nginx
查看启动进程
ps aux |grep nginx
查看监听端口
netstat -lnp | grep nginx
修改配置文件:
cd /usr/local/nginx/conf
vim nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
创建php解析页面
cd /usr/local/nginx/html/
vim info.php
service nginx restart
curl浏览测试
curl localhost/2.php
下载php到/usr/local/src目录下
[root@lnmp ~]# cd /usr/local/src/
[root@lnmp src]# wget http://mirrors.sohu.com/php/php-5.4.37.tar.gz
解压php:
[root@lnmp src]# tar -zxvf php-5.4.37.tar.gz
创建相关账号:
[root@lnmp src]# useradd -s /sbin/nologin php-fpm
安装扩展源
[root@lnmp php-5.4.37]# rpm -ivh "http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm"
安装php编译环境
[root@lnmp php-5.4.37]# yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel libjpeg-devel
配置变异参数:
[root@lnmp php-5.4.37]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6 --with-pear --with-curl --with-openssl
编译php:
[root@lnmp php-5.4.37]# make
安装php:
[root@lnmp php-5.4.37]# make install
复制配置文件:
[root@lnmp php-5.4.37]#cp php.ini-production /usr/local/php/etc/php.ini
复制启动脚本:
[root@lnmp php-5.4.37]#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@lnmp php-5.4.37]#chmod 755 /etc/init.d/php-fpm
重命名配置文件:
[root@lnmp php-5.4.37]#cd /usr/local/php/etc
[root@lnmp etc]#mv php-fpm.conf.default php-fpm.conf
启动:
[root@lnmp php-5.4.37]# chkconfig --add php-fpm
[root@lnmp php-5.4.37]# chkconfig php-fpm on
[root@lnmp php-5.4.37]# service php-fpm start
nginx编译安装
解压nginx安装包
tar -zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
安装编译环境所需插件
yum install -y libtool-ltdl-devel pcre-devel
配置编译环境
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
编译安装
make && make install
创建启动脚本而
vim /etc/init.d/nginx
#!/bin/bash# chkconfig: - 30 21# description: http service.# Source Function Library. /etc/init.d/functions# Nginx SettingsNGINX_SBIN="/usr/local/nginx/sbin/nginx"NGINX_CONF="/usr/local/nginx/conf/nginx.conf"NGINX_PID="/usr/local/nginx/logs/nginx.pid"RETVAL=0prog="Nginx"start() { echo -n $"Starting $prog: " mkdir -p /dev/shm/nginx_temp daemon $NGINX_SBIN -c $NGINX_CONF RETVAL=$? echo return $RETVAL}stop() { echo -n $"Stopping $prog: " killproc -p $NGINX_PID $NGINX_SBIN -TERM rm -rf /dev/shm/nginx_temp RETVAL=$? echo return $RETVAL}reload(){ echo -n $"Reloading $prog: " killproc -p $NGINX_PID $NGINX_SBIN -HUP RETVAL=$? echo return $RETVAL}restart(){ stop start}configtest(){ $NGINX_SBIN -c $NGINX_CONF -t return 0}case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; configtest) configtest ;; *) echo $"Usage: $0 {start|stop|reload|restart|configtest}" RETVAL=1esacexit $RETVAL
为启动脚本而赋予755权限
chmod 755 /etc/init.d/nginx
启动nginx
chkconfig --add nginx
chkconfig nginx on
service nginx start
/usr/local/nginx/sbin/nginx
查看启动进程
ps aux |grep nginx
查看监听端口
netstat -lnp | grep nginx
修改配置文件:
cd /usr/local/nginx/conf
vim nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
创建php解析页面
cd /usr/local/nginx/html/
vim info.php
service nginx restart
curl浏览测试
curl localhost/2.php
0
特意给您补上,哈哈
http://mirrors.sohu.com/nginx/nginx-1.6.2.tar.gz
a1138665328 发表于 2016-7-26 16:32
nginx的 wget地址呢
特意给您补上,哈哈
http://mirrors.sohu.com/nginx/nginx-1.6.2.tar.gz
编辑回复