1.需求
搭建mysql+php+nginx环境
2流程
分为5步,磁盘分区,安装vsftpd,安装nginx,安装php-fpm,安装mysql
3.磁盘分区
http://www.cnblogs.com/dudu/archive/2012/12/07/aliyun-linux-fdisk.html
4.安装 vsftpd
yum install vsftpd a.关闭selinux,http://www.cnblogs.com/norm/p/6269338.html b、useradd -d /webserver -s /sbin/nologin webftp 新建用户 c、passwd webftp 修改密码 sdafadsf54542016 d、chown -R webftp.webftp /webserver 修改指定目录的权限 e、vi /etc/vsftpd/vsftpd.conf 编辑vsftp配置文件 将配置文件中”anonymous_enable=YES “改为 “anonymous_enable=NO” 取消如下配置前的注释符号: local_enable=YES write_enable=YES chroot_local_user=YES f、 xferlog_std_format=YES xferlog_file=/webserver/logs/vsftpd/ftp.log xferlog_enable=YES (!!上传所有日志文件) 设置开机启动 chkconfig --level 345 vsftpd on
5.安装nginx
a、上传nginx-1.8.0.tar.gz b、tar zxvf nginx-1.8.0.tar.gz c、安装 yum install -y zlib zlib-devel d、安装 yum install -y openssl openssl-devel e、安装 yum install -y pcre pcre-devel 安装 yum install -y gd yum install gd-devel yum install libatomic_ops-devel f、进入nginx-1.8.0目录 g、./configure --prefix=/webserver/software/nginx/ --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-pcre --with-libatomic h、make make install i、nginx服务控制 ./nginx 启动 ./nginx -s reload 重启 nginx -t -c /usr/local/nginx/conf/nginx.conf 判断nginx.conf是否正确 停止 ps -ef | grep nginx kill -QUIT 主进程号 :从容停止Nginx kill -TERM 主进程号 :快速停止Nginx pkill -9 nginx :强制停止Nginx
cp /webserver/software/nginx/sbin/nginx /etc/init.d/
chmod +x /etc/init.d/nginx 给执行权限 chkconfig --level 345 nginx on 设为开机启动 j、配置nginx站点 详见示例nginx.conf
6.安装php-fpm
3、安装php-fpmd(必须在mysql之前安装,否则会mysqlclient之类的问题会报错) a、上传php-5.3.28.tar.gz b、解压 tar zxvf php-5.3.28.tar.gz c、安装必要的组件 yum install -y php-mcrypt yum install -y php-mysql yum install -y php-gd yum install -y php-imap yum install -y php-ldap yum install -y php-odbc yum install -y php-pear yum install -y php-xml yum install -y php-xmlrpc yum install -y php-mbstring yum install -y libmemcached yum install -y libmemcached-devel yum install -y php-pecl-memcached yum install -y memcached-devel yum install -y memcached yum install -y libxml2 yum install -y libxml2-devel yum install -y libcurl yum install -y libcurl-devel yum install -y openldap yum install -y openldap-devel yum install -y libmcrypt yum install -y libmcrypt-devel yum install -y mysql-devel 上传libiconv-1.14.tar.gz 并解压 tar zxvf libiconv-1.14.tar.gz (要先进入到解压后的目录里面) ./configure --prefix=/webserver/software/libiconv make make install 与安装 在/usr/local/lib/(/software/libiconv/lib)目录下生成库文件libcharset.so.1, libiconv.so.2。 d、进入cd /webserver/software_package/php-5.3.28 e、cp -frp /usr/lib64/libldap* /usr/lib/ f、export MYSQL_LIB_DIR=/usr/lib64/mysql 环境变量改为lib64位路径(安装mysql之前就要弄的) e、./configure --prefix=/webserver/software/php-fpm --with-config-file-path=/webserver/software/php-fpm/etc --with-mysql --with-mysqli --with-iconv-dir=/webserver/software/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-iconv-dir=/webserver/software/libiconv --with-libmcrypt --enable-ftp --with-freetype-dir --with-memcached make make install f、 拷贝 cp /webserver/software_package/php-5.3.28/php.ini-production /webserver/software/php-fpm/etc/php.ini cp /webserver/software/php-fpm/etc/php-fpm.conf.default /webserver/software/php-fpm/etc/php-fpm.conf g、 启动 /webserver/software/php-fpm/sbin/php-fpm -c /webserver/software/php-fpm/etc/php.ini -y /webserver/software/php-fpm/etc/php-fpm.conf 执行权限:chmod 777 /webserver/software/php-fpm h、 配置PHP支持ZendGuardLoader 上传 ZendGuardLoader.so cp webserver/software_package/ZendGuardLoader.so /webserver/software/php-fpm/lib/ 移动至此处:/webserver/software/php-fpm/lib/ZendGuardLoader.so (去 /etc/php.ini) 配置php.ini 追加 zend_extension=/usr/lib64/ZendGuardLoader.so zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 如果开支持memcached扩展添加以下 extension=/usr/lib64/php/modules/memcached.so 重启php-fpd 制作服务启动 cp /webserver/software/php-fpm/sbin/php-fpm /etc/init.d/ chmod +x /etc/init.d/php-fpm 给执行权限 chkconfig --level 345 php-fpm on(一直失败)
时间: 2024-09-27 04:27:50