最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CentOS 6.3中配置安装nginx php-fpm drupal的方法
时间:2022-11-14 22:09:28 编辑:袖梨 来源:一聚教程网
一切本着从简原则来做,能yum/rpm的,坚决不手工编译,本次部署环境基于CentOS 6.3 x86_64系统。
更新yum
代码如下 | 复制代码 |
[root@imysql ~]# yum -y update |
安装curl模块
代码如下 | 复制代码 |
[root@imysql ~]# yum install curl-devel |
安装nginx
代码如下 | 复制代码 |
[root@imysql ~]# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm |
安装php-fpm
代码如下 | 复制代码 |
[root@imysql ~]# rpm -ivh rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm |
配置nginx+php
/etc/nginx/nginx.conf 配置文件可以不用做任何修改。
编辑 /etc/nginx/conf.d/default.conf,以本站为例,配置文件如下:
代码如下 | 复制代码 |
server { root /data/www/www.111com.net/; error_page 404 /page_not_found; location ~ /.ht { if ($fastcgi_script_name ~ ..*/.*php) { location / { location ~ .php$ { location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { location ~ .*.(js|css)?$ { location ^~ /sites/default/files/imagecache/ { |
上述配置包括了nginx虚拟主机的配置,以及drupal的rewrite规则配置,简单快速。
启动测试
每次修改完配置文件后,都记得执行下面的命令测试配置文件正确性:
代码如下 | 复制代码 |
[root@imysql ~]# /etc/init.d/nginx configtest |
确认配置文件无误后,执行下面的命令重载nginx,使其生效,上面仔细一点的朋友会发现没有安装mysql数据库了,因为drupal是需要数据库支持的
Drupal是使用PHP语言编写的开源内容管理框架(CMF),它由内容管理系统(CMS)和PHP开发框架(Framework)共同构成,所以我们再接着来安装mysql数据库吧
安装mysql数据库
执行yum程序安装MySQL
代码如下 | 复制代码 |
1.yum install mysql mysql-server |
添加MySQL进启动项(这样系统启动时会自动启动MySQL),并立即启动MySQL服务器:
代码如下 | 复制代码 |
1.chkconfig --levels 235 mysqld on 2./etc/init.d/mysqld start |
设置MySQL root帐号密码:
代码如下 | 复制代码 |
1.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):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <-- ENTER
New password: <-- 你的MySQL root密码
Re-enter new password: <-- 你的MySQL root密码
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <-- ENTER
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <-- ENTER
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <-- ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <-- ENTER
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
安装phpmyadmin
从phpmyadmin官方网站:http://www.phpmyadmin.net/home_page/downloads.php下载最新的phpmyadmin安装包,下载到网站目录下默认在/var/www/html/下。解压phpmyadmin压缩包后,找到 config.sample.inc.php 重命名为 config.inc.php,修改配置,就安装完成了。
代码如下 | 复制代码 |
[root@imysql ~]# [root@imysql ~]# /etc/init.d/nginx reload |
至此,配置完成!
相关文章
- 云星穹铁道权益升级怎么玩 云崩铁权益升级活动介绍 12-03
- 以闪亮之名山中绘梦怎么玩 以闪亮之名滢然花梦套装活动介绍 12-03
- 以闪亮之名绿野梦歌礼包怎么样 以闪亮之名绿野梦歌拍照礼包介绍 12-03
- 光遇12.6有什么更新 光遇12月6日更新内容介绍 12-03
- 伍六七暗影交锋测试资格怎么获得 伍六七暗影交锋内测资格获取方法 12-03
- 无限暖暖晶莹诗集怎么样 12-03