|
首先介绍:Nginx是一个免费开放的、高性能的HTTP服务器,nginx是集稳定、结构简单、低资源消耗为特色,这篇文章介绍的是nginx在centos 6.0 上与php5、mysql的技术支持。这个方法对我试用,但对你也许不合适,这是个参考。
1 初步
这一课中主机名为:server1.example.com,ip 地址为:192.168.0.100. 这两项在你们的环境中必须改为适合于你们的。
2 授权附加的库
php-fpm 是不能用centos 官方下载的库,须从remi rpm 下载库,我们可以使用下面两者:
rpm --import https://fedoraproject.org/static/0608B895.txt
rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.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...
vi /etc/yum.repos.d/epel.repo
并增加以下:
[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 to 1。
vi /etc/yum.repos.d/remi.repo
[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
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
3 安装mysql 5.
首先我们安装mysql 5 如下:
yum install mysql mysql-server
然后我们创建系统启动环节,
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
现在我们检查是否启动连接网络
netstat -tap | grep mysql
正如显示的:
[root@server1 ~]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 2302/mysqld
[root@server1 ~]#
如果不那样做的话,编辑/etc/my.cnf 和连接的选择 skip-networking:
vi /etc/my.cnf
[...]
#skip-networking
[...]
现在我们重启mysql服务。
/etc/init.d/mysqld restart
运行:
mysql_secure_installation
设置一个根用户名:
[root@server1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
|
|
|