| 
二、红帽企业版RHEL6.4 安装完成后的基本操作 红帽企业版6.4安装过程比较简单,这里笔者就不赘述了。下面看看安装完成后的基本操作。说明这里笔者使用的是Centos 6.4 X86 版本。 1、首先设置软件源 rpm --import https://fedoraproject.org/static/0608B895.txtrpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
 rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 yum install yum-priorities
 修改/etc/yum.repos.d/epel.repo文件如下(说明这里需要把增加优先级设置 priority=10 ,其他不变): [epel]name=Extra Packages for Enterprise Linux 6 - $basearch
 #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
 mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
 failovermethod=priority
 enabled=1
 priority=10
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
 [...]
 修改/etc/yum.repos.d/remi.repo文件如下: 将  enabled 设置为1 ,其他不变, [remi]name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
 #baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
 mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
 enabled=1
 priority=10
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 failovermethod=priority
 
 [remi-test]
 name=Les RPM de remi en test pour Enterprise Linux $releasever - $basearch
 #baseurl=http://rpms.famillecollet.com/enterprise/$releasever/test/$basearch/
 mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/test/mirror
 enabled=0
  
 
2、搭建一个LNMP环境 LNMP代表的就是:Linux系统下Nginx+MySQL+PHP这种网站服务器架构。Nginx性能稳定、功能丰富、运维简单、处理静态文件
速度快且消耗系统资源极少。作为 Web 服务器:相比 Apache,Nginx 
使用更少的资源,支持更多的并发连接,体现更高的效率。作为负载均衡服务器:Nginx 既可以在内部直接支持 Rails 和 PHP,也可以支持作为
 HTTP代理服务器对外进行服务。Nginx 
用C编写,不论是系统资源开销还是CPU使用效率都比Perlbal要好的多。作为邮件代理服务器:Nginx同时也是一个非常优秀的邮件代理服务器(最
早开发这个产品的目的之一也是作为邮件代理服务器),Last/fm 描述了成功并且美妙的使用经验。Nginx 
安装非常的简单,配置文件非常简洁(还能够支持perl语法)。Nginx支持平滑加载新的配置,还能够在不间断服务的情况下进行软件版本的升级。 (1)首先安装Mysql5 yum install mysql mysql-serverchkconfig --levels 235 mysqld on
 /etc/init.d/mysqld start
 下面运行mysql_secure_installation命令,它会执行几个设置: a)为root用户设置密码 b)删除匿名账号 c)取消root用户远程登录 d)删除test库和对test库的访问权限 e)刷新授权表使修改生效 通过这几项的设置能够提高mysql库的安全。具体操作过程这里笔者不赘述了如图3。 
 (2)安装Nginx yum install nginxThen we create the system startup links for nginx and start it:
 chkconfig --levels 235 nginx on
 /etc/init.d/nginx start
 
 测试一下如图4: 
 图4 测试一下 (3)安装配置php 模块 yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy php-pecl-apc
 修改配置文件/etc/php.ini 设置cgi.fix_pathinfo=0 [...]cgi.fix_pathinfo=0
 [...]
 (4)修改 nginx配置文件 vi /etc/nginx/nginx.conf 修改为: [...]worker_processes  4;
 [...]
 keepalive_timeout  2;
 [...]
 vi /etc/nginx/conf.d/default.conf 修改为: [...]server {
 listen       80;
 server_name  _;
 #charset koi8-r;
 #access_log  logs/host.access.log  main;
 location / {
 root   /usr/share/nginx/html;
 index  index.php index.html index.htm;
 }
 error_page  404              /404.html;
 location = /404.html {
 root   /usr/share/nginx/html;
 }
 # redirect server error pages to the static page /50x.html
 #
 error_page   500 502 503 504  /50x.html;
 location = /50x.html {
 root   /usr/share/nginx/html;
 }
 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 #location ~ \.php$ {
 #    proxy_pass   http://127.0.0.1;
 #}
 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 location ~ \.php$ {
 root           /usr/share/nginx/html;
 try_files $uri =404;
 fastcgi_pass   127.0.0.1:9000;
 fastcgi_index  index.php;
 fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 include        fastcgi_params;
 }
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 location ~ /\.ht {
 deny  all;
 }}
 重新加载: /etc/init.d/nginx reload 编写一个php文件测试 vi /usr/share/nginx/html/info.php 如图5: 
 图5 编写一个php文件测试  
 |