热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Llinux系统配置NginxPHP(fastcgi)MySQLWEB服务环境

原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明。否则将追究法律责任。本文主要是配置nginx+php(fastcgi)ESX4虚拟机环境:Redhat5.4x32CPU:i5E23002.8G4核内存:2GB安装顺序:1、libiconv-1.14.tar.gz2、l
本文主要是配置nginx+php(fastcgi)   
ESX4虚拟机环境:

  Redhat 5.4 x32
  CPU: i5 E2300 2.8G 4核
  内存:2GB
  
安装顺序:
  1、libiconv-1.14.tar.gz
  2、libmcrypt-2.5.8.tar.gz
  3、mhash-0.9.9.9.tar.bz2
  4、mcrypt-2.6.8.tar.gz
  5、cmake-2.8.4.tar.gz
  6、mysql-5.5.13.tar.gzl
  7、php-5.3.6.tar.bz2 (pdo-mysql,php-pfm已经被加到里面去了)
  8、memcached-1.4.6.tar.gz
  9、eaccelerator-0.9.6.1.zip
  10、Imagemagick
  11、imagick-3.0.1.tgz
  12、pcre-8.02.tar.bz2
  13、nginx-1.0.5.tar.gz
  
假定所有包均已经下载:<这么多包,装起来头晕@_@!>
  一、安装所有包
  #install libiconv-1.1.4.tar.gz
  [root@svr1 lnmp]# mkdir /usr/src/lnmp
  [root@svr1 lnmp]# tar -xzf libiconv-1.14.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/libiconv-1.14/
  [root@svr1 libiconv-1.14]# mkdir /usr/local/lnmp
  [root@svr1 libiconv-1.14]# ./configure --prefix=/usr/local/lnmp/libiconv
  [root@svr1 libiconv-1.14]# make && make install
  #install libmcrypt-2.5.8.tar.gz
  [root@svr1 lnmp]# tar -xzf libmcrypt-2.5.8.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/libmcrypt-2.5.8/
  [root@svr1 libmcrypt-2.5.8]# ./configure
  [root@svr1 libmcrypt-2.5.8]# make && make install
  [root@svr1 libmcrypt-2.5.8]# cd libltdl/
  [root@svr1 libltdl]# ./configure --enable-ltdl-install
  #install mhash-0.9.9.9.tar.bz2
  [root@svr1 lnmp]# tar -xjf mhash-0.9.9.9.tar.bz2 -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/mhash-0.9.9.9/
  [root@svr1 mhash-0.9.9.9]# ./configure
  [root@svr1 mhash-0.9.9.9]# make && make install
  #install mcrypt
  [root@svr1 lnmp]#tar -xzf mcrypt-2.6.8.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]#cd /usr/src/lnmp/mcrypt-2.6.8/
  [root@svr1 mcrypt-2.6.8]# ./configure
  *** Could not run libmcrypt test program, checking why...
  *** The test program compiled, but did not run. This usually means
  *** that the run-time linker is not finding LIBMCRYPT or finding the wrong
  *** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
  *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
  *** to the installed location Also, make sure you have run ldconfig if that
  *** is required on your system
  ***
  *** If you have an old version installed, it is best to remove it, although
  *** you may also be able to get things to work by modifying LD_LIBRARY_PATH
  ***
  configure: error: *** libmcrypt was not found
  出现以上报错时,建立两个软连接就解决了。
  [root@svr1 mcrypt-2.6.8]# ln -s /usr/local/lib/libmcrypt* /usr/lib/
  [root@svr1 mcrypt-2.6.8]# ln -s /usr/local/lib/libmhash.* /usr/lib/
  [root@svr1 mcrypt-2.6.8]# /sbin/ldconfig
  [root@svr1 mcrypt-2.6.8]# make && make install
  #install cmake
  [root@svr1 lnmp]# tar -xzf cmake-2.8.4.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/cmake-2.8.4/
  [root@svr1 cmake-2.8.4]# ./configure
  [root@svr1 cmake-2.8.4]# make && make install
  mysql是我的弱项,相关编译方法参见http://heylinux.com/archives/993.html网友
  #install mysql
  [root@svr1 ~]# useradd mysql
  [root@svr1 ~]# mkdir -p /data/mysql
  [root@svr1 ~]# chown -R mysql.mysql /data/mysql
  [root@svr1 ~]# tar -xzf lnmp/mysql-5.5.13.tar.gz -C /usr/src/lnmp/
  [root@svr1 ~]# cd /usr/src/lnmp/mysql-5.5.13/
  [root@svr1 mysql-5.5.13]# cmake -DCMAKE_INSTALL_PREFIX=/data/mysql \
  -DSYSCOnFDIR=/opt/mysql/etc \
  -DMYSQL_DATADIR=/opt/mysql/data \
  -DMYSQL_TCP_PORT=3306 \
  -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
  -DMYSQL_USER=mysql \
  -DEXTRA_CHARSETS=all \
  -DWITH_READLINE=1 \
  -DWITH_SSL=system \
  -DWITH_EMBEDDED_SERVER=1 \
  -DENABLED_LOCAL_INFILE=1 \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DWITHOUT_PARTITION_STORAGE_ENGINE=1
  出现警告,可以忽略,对mysql没有影响。
  CMake Warning: The variable, 'MYSQL_USER', specified manually, was not used during the generation.
  CMake Warning: The variable, 'WITH_MEMORY_STORAGE_ENGINE', specified manually, was not used during the generation.
  [root@svr1 mysql-5.5.13]# make
  [root@svr1 mysql-5.5.13]# make install
  [root@svr1 mysql-5.5.13]# mkdir /usr/local/mysql/{etc,log}
  [root@svr1 mysql-5.5.13]# cp support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf
  [root@svr1 mysql-5.5.13]# chmod 755 scripts/mysql_install_db
  [root@svr1 mysql-5.5.13]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --
  datadir=/usr/local/mysql/data/
  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  To do so, start the server, then issue the following commands:
  /usr/local/mysql//bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql//bin/mysqladmin -u root -h svr1.labexam.com password 'new-password'
  Alternatively you can run:
  /usr/local/mysql//bin/mysql_secure_installation
  which will also give you the option of removing the test
  databases and anonymous user created by default. This is
  strongly recommended for production servers.
  See the manual for more instructions.
  You can start the MySQL daemon with:
  cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &
  You can test the MySQL daemon with mysql-test-run.pl
  cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl
  Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!
  #设置一个密码
  [root@svr1 etc]# /usr/local/mysql/bin/mysqladmin -u root password 'redhat'
  [root@svr1 etc]# /usr/local/mysql/bin/mysqld_safe &
  #启来了
  [root@svr1 etc]# lsof -i:3306
  COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
  mysqld 7123 mysql 10u IPv6 TCP *:mysql (LISTEN)
  #登录mysql
  [root@svr1 etc]# /usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
  Enter password: redhat
  Welcome to the MySQL monitor. Commands end with ; or \g.
  Your MySQL connection id is 4
  Server version: 5.5.13 Source distribution
  Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective
  owners.
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin@localhost' IDENTIFIED BY 'redhat';
  Query OK, 0 rows affected (0.00 sec)
  添加admin用户并设置密码
  mysql> GRANT ALL PRIVILEGES ON *.* TO '' IDENTIFIED BY 'redhat';
  Query OK, 0 rows affected (0.00 sec)
  mysql> use mysql;
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  Database changed
  mysql> select Host,User,Password from user; #查看所有用户,密码情况
  +------------------+-----------------+------------ -------------------------------+
  | Host | User | Password |
  +------------------+-----------------+------------ -------------------------------+
  | localhost | root | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | svr1.labexam.com | root | |
  | 127.0.0.1 | root | |
  | ::1 | root | |
  | localhost | | |
  | svr1.labexam.com | | |
  | % | admin@localhost | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  +------------------+-----------------+------------ -------------------------------+
  8 rows in set (0.00 sec)
  mysql> delete from user where password=""; #删除所有空密码的用户
  Query OK, 5 rows affected (0.00 sec)
  mysql> flush privileges;
  Query OK, 0 rows affected (0.00 sec)
  mysql> select Host,User,Password from user; #确认删除情况
  +-----------+-----------------+------------------- ------------------------+
  | Host | User | Password |
  +-----------+-----------------+------------------- ------------------------+
  | localhost | root | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | admin@localhost | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  +-----------+-----------------+------------------- ------------------------+
  3 rows in set (0.00 sec)
  mysql> exit
  #my.cnf文件暂未做任何修改。


推荐阅读
  • 构建LNMP架构平台
    LNMP架构的组成:Linux、Nginx、MySQL、PHP关于NginxNginx与apache的作用一样,都是为了搭建网站服务器,由俄罗斯人lgorsysoev开发,其特点是 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • CEPH LIO iSCSI Gateway及其使用参考文档
    本文介绍了CEPH LIO iSCSI Gateway以及使用该网关的参考文档,包括Ceph Block Device、CEPH ISCSI GATEWAY、USING AN ISCSI GATEWAY等。同时提供了多个参考链接,详细介绍了CEPH LIO iSCSI Gateway的配置和使用方法。 ... [详细]
  • 腾讯安全平台部招聘安全工程师和数据分析工程师
    腾讯安全平台部正在招聘安全工程师和数据分析工程师。安全工程师负责安全问题和安全事件的跟踪和分析,提供安全测试技术支持;数据分析工程师负责安全产品相关系统数据统计和分析挖掘,通过用户行为数据建模为业务决策提供参考。招聘要求包括熟悉渗透测试和常见安全工具原理,精通Web漏洞,熟练使用多门编程语言等。有相关工作经验和在安全站点发表作品的候选人优先考虑。 ... [详细]
  • PHP组合工具以及开发所需的工具
    本文介绍了PHP开发中常用的组合工具和开发所需的工具。对于数据分析软件,包括Excel、hihidata、SPSS、SAS、MARLAB、Eview以及各种BI与报表工具等。同时还介绍了PHP开发所需的PHP MySQL Apache集成环境,包括推荐的AppServ等版本。 ... [详细]
  • 本文介绍了在无法联网的情况下,通过下载rpm包离线安装zip和unzip的方法。详细介绍了如何搜索并下载合适的rpm包,以及如何使用rpm命令进行安装。 ... [详细]
  • Linux下部署Symfoy2对app/cache和app/logs目录的权限设置,symfoy2logs
    php教程|php手册xml文件php教程-php手册Linux下部署Symfoy2对appcache和applogs目录的权限设置,symfoy2logs黑色记事本源码,vsco ... [详细]
  • Linux一键安装web环境全攻略
    摘自阿里云服务器官网,此处一键安装包下载:点此下载安装须知1、此安装包可在阿里云所有Linux系统上部署安装,此安装包包含的软件及版本为& ... [详细]
  • 让你明白kvm是什么
    参考:https:blog.csdn.netbbwangjarticledetails80465320KVM工具集合:libvirt:操作和管理KVM虚机的虚拟化API ... [详细]
  • GetWindowLong函数
    今天在看一个代码里头写了GetWindowLong(hwnd,0),我当时就有点费解,靠,上网搜索函数原型说明,死活找不到第 ... [详细]
  • 众筹商城与传统商城的区别及php众筹网站的程序源码
    本文介绍了众筹商城与传统商城的区别,包括所售产品和玩法不同以及运营方式不同。同时还提到了php众筹网站的程序源码和方维众筹的安装和环境问题。 ... [详细]
  • IT方面的论坛太多了,有综合,有专业,有行业,在各个论坛里混了几年,体会颇深,以前是论坛哪里人多 ... [详细]
  • 本文介绍了在Ubuntu下制作deb安装包及离线安装包的方法,通过备份/var/cache/apt/archives文件夹中的安装包,并建立包列表及依赖信息文件,添加本地源,更新源列表,可以在没有网络的情况下更新系统。同时提供了命令示例和资源下载链接。 ... [详细]
  • 有关phpfgetss()函数的文章推荐10篇
    有关phpfgetss()函数的文章推荐10篇:了解如何使用PHP的各种文件函数。查看诸如fopen、fclose和feof之类的基本文件函数;了解诸如fgets、fgetss和f ... [详细]
author-avatar
余小刚玩guitarvp_996
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有