Linux 下的php,nginx,mysql的安装
- yum -y install wget make vim install gcc gcc-c++ ncurses ncurses-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel zlip zlip-devel
新建软件安装目录
- mkdir /usr/local/webserver
php依赖库安装
libxml2(包含库和实用工具用于解析XML文件)
- tar zxvf libxml2-2.9.0.tar.gz -C /usr/local/webserver/
- cd /usr/local/webserver/libxml2-2.9.0
- ./configure
- make&&make install
libmcrypt(加密算法扩展库支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法)
- tar zxvf libmcrypt-2.5.8.tar.gz -C /usr/local/webserver/
- cd /usr/local/webserver/libmcrypt-2.5.8
- ./configure
- make && make install
nginx安装
- tar zxvf nginx-1.5.9.tar.gz -C /usr/local/webserver/
- mv /usr/local/webserver/nginx-1.5.9 /usr/local/webserver/nginx
- cd /usr/local/webserver/nginx
- ./configure
- make && make install
- vi /etc/init.d/nginx
- #!/bin/sh
- #
- # nginx - this script starts and stops the nginx daemin
- #
- # chkconfig: - 85 15
- # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
- # proxy and IMAP/POP3 proxy server
- # processname: nginx
- # config: /usr/local/nginx/conf/nginx.conf
- # pidfile: /usr/local/nginx/logs/nginx.pid
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Check that networking is up.
- [ "$NETWORKING" = "no" ] && exit 0
- nginx="/usr/local/nginx/sbin/nginx"
- prog=$(basename $nginx)
- NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
- lockfile=/var/lock/subsys/nginx
- start() {
- [ -x $nginx ] || exit 5
- [ -f $NGINX_CONF_FILE ] || exit 6
- echo -n $"Starting $prog: "
- daemon $nginx -c $NGINX_CONF_FILE
- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
- }
- stop() {
- echo -n $"Stopping $prog: "
- killproc $prog -QUIT
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
- }
- restart() {
- configtest || return $?
- stop
- start
- }
- reload() {
- configtest || return $?
- echo -n $"Reloading $prog: "
- killproc $nginx -HUP
- RETVAL=$?
- echo
- }
- force_reload() {
- restart
- }
- configtest() {
- $nginx -t -c $NGINX_CONF_FILE
- }
- rh_status() {
- status $prog
- }
- rh_status_q() {
- rh_status >/dev/null 2>&1
- }
- case "$1" in
- start)
- rh_status_q && exit 0
- $1
- ;;
- stop)
- rh_status_q || exit 0
- $1
- ;;
- restart|configtest)
- $1
- ;;
- reload)
- rh_status_q || exit 7
- $1
- ;;
- force-reload)
- force_reload
- ;;
- status)
- rh_status
- ;;
- condrestart|try-restart)
- rh_status_q || exit 0
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
- exit 2
- esac
修改nginx脚本权限
- chmod +x /etc/init.d/nginx
添加到系统服务
- /sbin/chkconfig nginx on
mysql安装
- groupadd mysql
- useradd -r -g mysql mysql
- tar zxvf mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz -C /usr/local/webserver/
- mv /usr/local/webserver/mysql-5.6.16-linux-glibc2.5-x86_64 /usr/local/webserver/mysql
- ## ln -s /usr/local/webserver/mysql-5.6.16-linux-glibc2.5-x86_64 /usr/local/webserver/mysql
- cd /usr/local/webserver/mysql/
- chown -R mysql .
- chgrp -R mysql .
- scripts/mysql_install_db --user=mysql
- chown -R root .
- chown -R mysql data
- cp support-files/my-default.cnf /etc/my.cnf
- bin/mysqld_safe --user=mysql &
修改mysql.server脚本
- vi support-files/mysql.server
- basedir=
- datadir=
- 改为
- basedir=/usr/local/webserver/mysql
- datadir=/usr/local/webserver/mysql/data
配置启动脚本
- cp support-files/mysql.server /etc/init.d/mysqld
添加到环境变量
- vi ~/.bash_profile
- PATH=$PATH:$HOME/bin:/usr/local/webserver/mysql/bin
php安装
gd库安装
- tar zxvf gd-2.0.33.tar.gz
- cd gd-2.0.33
- ./configure --prefix=/usr/local/webserver/gd2/
- make && make install
- tar zxvf php-5.3.28.tar.gz -C /usr/local/webserver/
- mv /usr/local/webserver/php-5.3.28/ /usr/local/webserver/php
- cd /usr/local/webserver/php
- ./configure --enable-fpm --with-mysql=/usr/local/webserver/mysql/ --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-config-file-path=/usr/local/webserver/php/ --with-openssl --enable-mbstring --with-zlib --enable-xml --with-gd=/usr/local/webserver/gd2/ --with-jpeg-dir --enable-bcmath --with-mcrypt --with-iconv --enable-pcntl --enable-shmop --enable-simplexml --enable-ftp
- make && make install
- cp php.ini-development /usr/local/webserver/php/php.ini
配置php.ini
- vim php.ini
- ;date.timezone =
- 改为 date.timezone = prc
配置nginx.conf
- mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bak
- vim /usr/local/nginx/conf/nginx.conf
- user root root;
- worker_processes 1;
- #error_log logs/error.log;
- #error_log logs/error.log notice;
- #error_log logs/error.log info;
- #pid logs/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
- #access_log logs/access.log main;
- sendfile on;
- #tcp_nopush on;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- server {
- listen 80;
- server_name 192.168.51.33;
- root /home/www;
- autoindex on;
- autoindex_exact_size off;
- autoindex_localtime on;
- #配置站点伪静态(此处配置好之后,需要在ecstore/config/config.php中修改“define('WITH_REWRITE',true);”)
- if ($request_uri ~ (.+?\.php)(|/.*)$ ){
- break;
- }
- if (!-e $request_filename) {
- rewrite ^/(.*)$ /index.php/$1 last;
- }
- location / {
- index index.php index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- location ~ \.php {
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- #设置pathinfo
- set $path_info "";
- set $real_script_name $fastcgi_script_name;
- if ($fastcgi_script_name ~ "^(.+?.php)(/.+)?$") {
- set $script_name $1;
- set $path_info $2;
- }
- fastcgi_param SCRIPT_NAME $script_name;
- fastcgi_param PATH_INFO $path_info;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- }
- }
- # 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 somename:8080;
- # server_name somename alias another.alias;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
- # HTTPS server
- #
- #server {
- # listen 443;
- # server_name localhost;
- # ssl on;
- # ssl_certificate cert.pem;
- # ssl_certificate_key cert.key;
- # ssl_session_timeout 5m;
- # ssl_protocols SSLv2 SSLv3 TLSv1;
- # ssl_ciphers HIGH:!aNULL:!MD5;
- # ssl_prefer_server_ciphers on;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
- }
配置php.ini
- vi /usr/local/webserver/php/php.ini
- enable_dl = On
- cgi.force_redirect = 0
- cgi.fix_pathinfo=1
- fastcgi.impersonate = 1
- cgi.rfc2616_headers = 1
- allow_url_fopen = On
配置php-fpm启动脚本
- vi /etc/init.d/php-fpm
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: php-fpm
- # Required-Start: $remote_fs $network
- # Required-Stop: $remote_fs $network
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts php-fpm
- # Description: starts the PHP FastCGI Process Manager daemon
- ### END INIT INFO
- prefix=/usr/local/
- php_fpm_BIN=${prefix}/sbin/php-fpm
- php_fpm_CONF=${prefix}/etc/php-fpm.conf
- php_fpm_PID=${prefix}/var/run/php-fpm.pid
- php_opts="--fpm-config $php_fpm_CONF"
- php_pid="--pid $php_fpm_PID"
- wait_for_pid () {
- try=0
- while test $try -lt 35 ; do
- case "$1" in
- 'created')
- if [ -f "$2" ] ; then
- try=''
- break
- fi
- ;;
- 'removed')
- if [ ! -f "$2" ] ; then
- try=''
- break
- fi
- ;;
- esac
- echo -n .
- try=`expr $try + 1`
- sleep 1
- done
- }
- case "$1" in
- start)
- echo -n "Starting php-fpm "
- $php_fpm_BIN $php_opts $php_pid
- if [ "$?" != 0 ] ; then
- echo " failed"
- exit 1
- fi
- wait_for_pid created $php_fpm_PID
- if [ -n "$try" ] ; then
- echo " failed"
- exit 1
- else
- echo " done"
- fi
- ;;
- stop)
- echo -n "Gracefully shutting down php-fpm "
- if [ ! -r $php_fpm_PID ] ; then
- echo "warning, no pid file found - php-fpm is not running ?"
- exit 1
- fi
- kill -QUIT `cat $php_fpm_PID`
- wait_for_pid removed $php_fpm_PID
- if [ -n "$try" ] ; then
- echo " failed. Use force-exit"
- exit 1
- else
- echo " done"
- fi
- ;;
- force-quit)
- echo -n "Terminating php-fpm "
- if [ ! -r $php_fpm_PID ] ; then
- echo "warning, no pid file found - php-fpm is not running ?"
- exit 1
- fi
- kill -TERM `cat $php_fpm_PID`
- wait_for_pid removed $php_fpm_PID
- if [ -n "$try" ] ; then
- echo " failed"
- exit 1
- else
- echo " done"
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- echo -n "Reload service php-fpm "
- if [ ! -r $php_fpm_PID ] ; then
- echo "warning, no pid file found - php-fpm is not running ?"
- exit 1
- fi
- kill -USR2 `cat $php_fpm_PID`
- echo " done"
- ;;
- *)
- echo "Usage: $0 {start|stop|force-quit|restart|reload}"
- exit 1
- ;;
- esac
脚本执行权限
- cd /usr/local/etc && cp php-fpm.conf.default php-fpm.conf
- chmod +x /etc/init.d/php-fpm
设置开机启动
- /sbin/chkconfig php-fpm on
/******下面是ecstore所需******/
ZendGuard安装
- tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/local/webserver/
- mv /usr/local/webserver/ZendGuardLoader-php-5.3-linux-glibc23-x86_64 /usr/local/webserver/ZendGuardLoader
- cd /usr/local/webserver/ZendGuardLoader
- cp php-5.3.x/ZendGuardLoader.so /usr/local/webserver/php/ext/
配置php.ini
- vi /usr/local/webserver/php/php.ini
- [Zend Guard]
- ;/usr/local/webserver/php/ext/ZendGuardLoader.so 这个是你当时指定的zend的目录
- zend_extension=/usr/local/webserver/php/ext/ZendGuardLoader.so
- zend_loader.enable=1
- zend_loader.disable_licensing=0
- zend_loader.obfuscation_level_support=3
- zend_loader.license_path=
Linux 下的php,nginx,mysql的安装的更多相关文章
- linux下导入、导出mysql数据库命令 下载文件到本地
一.下载到本地 yum install lrzsz sz filename 下载 rz filename 上传 linux下导入.导出mysql数据库命令 一.导出数据库用mysqldump命 ...
- ubuntu下的apache+php+mysql的安装
平时我都时在windows下搭配apache+php+mysql环境的,只不过后来听别人说在linux下搭配apache+php+mysql更受欢迎,而且一般公司也是用这样的搭配,所以今天在试着在ub ...
- Linux下beego及beego相关插件安装
Linux下beego及beego相关插件安装 1.下载及配置go环境看见链接: http://golang.org/dl/ 网盘:链接: https://pan.baidu.com/s/1MveUM ...
- Linux下以tar包的形式安装mysql8.0.28
Linux下以tar包的形式安装mysql8.0.28 1.首先卸载自带的Mysql-libs(如果之前安装过mysql,要全都卸载掉) rpm -qa | grep -i -E mysql\|mar ...
- Linux下SVN服务器安装配置及客户端安装说明
原文地址:http://wenku.baidu.com/link?url=h3dVAMx4azpOXEND5HQEE6nliE8-zc0GSQ03yv4cUs1vXMALXF64UsK7kT7kXm_ ...
- VMware Linux下拖拽补丁vmtools的安装和卸载
Linux下拖拽补丁vmtools的安装和卸载 by:授客 QQ:1033553122 Vmware 8.0.4为例子 步骤1.VM->Install Vmware Tools... 步骤2.查 ...
- Linux下 rz 和 sz 命令的安装与使用
目录 Linux下 rz 和 sz 命令的安装与使用 rz/sz命令的安装 sz命令-发送文件到本地(下载): rz命令-本地上传文件到服务器(上传): 声明 Linux下 rz 和 sz 命令的安装 ...
- linux下应用crontab对mysql数据库进行定时备份
linux下应用crontab对mysql数据库进行定时备份 @(编程) mysql数据库提供了备份命令mysqldump,可以结合crontab命令进行定时备份. 我写了一个mysqlbackup. ...
- Linux下Apache2.2和PHP5的安装配置
Linux下Apache2.2和PHP5的安装配置 环境介绍 我安装使用的Linux版本为CentOS6.5最精简版,Apache为2.2.29,PHP版本为5.4.28. 系统安装 首先安装Cent ...
随机推荐
- Android平台的事件处理机制和手指滑动例子
Android平台的事件处理机制有两种 基于回调机制的事件处理:Android平台中,每个View都有自己的处理事件的回调方法,开发人员可以通过重写View中的这些回调方法来实现需要的响应事件. 基于 ...
- 平时的笔记04:处理stagger模块
#! /usr/bin/env python3 # # __init__.py # From the stagger project: http://code.google.com/p/stagger ...
- [[UIScreen mainScreen] scale]详解
[[UIScreen mainScreen] scale]详解 当屏幕分别为640x940时[[UIScreen mainScreen] scale]=2.0 当屏幕分别为320x480时[[UISc ...
- [Immutable.js] Working with Subsets of an Immutable.js Map()
Immutable.js offers methods to break immutable structures into subsets much like Array--for instance ...
- CreateFile使用方法和样例
函数原型: HANDLE CreateFile( LPCTSTR lpFileName, //指向文件名称的指针 DWORD dwDesiredAccess, //訪问模式(写/读) DWORD dw ...
- servlet获得完整路径
request.getQueryString() request.getParameterMap() request.getParameterNames() 在servlet中GET请求可以通过Htt ...
- SQLLoader8(加载的数据中有换行符处理方法)
SQLLDR加载的数据中有换行符处理方法1.创建测试表: CREATE TABLE MANAGER( MGRNO NUMBER, MNAME ), JOB ), REMARK ) ); 2.创建控制文 ...
- 网页body中background在ie中显示不出来
网页body中background在ie中显示不出来 | 浏览:349 | 更新:2014-03-11 14:03 刚才上班在公司网站上写一个页面,在谷歌浏览器,火狐浏览器里调试完后,一切正常,忽然想 ...
- Cortex-M3知识点
1.不再像别的ARM7那样从thumb状态和ARM状态来回切换 Thumb-2指令集横空出世,Cortex-M3不支持ARM指令集 2.BKP备份寄存器(42个16位寄存器组成),用来存储用户应用程序 ...
- (原)使用vectot的.end()报错:iterators incompatible
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5070672.html 参考网址: http://blog.csdn.net/yxnyxnyxnyxny ...