CentOS 6.3下nginx、php-fpm、drupal快速部署
2016-12-05 22:27
417 查看
一切本着从简原则来做,能yum/rpm的,坚决不手工编译 :)
本次部署环境基于CentOS 6.3 x86_64系统。
0. 准备工作
/etc/nginx/nginx.conf 配置文件可以不用做任何修改。
编辑 /etc/nginx/conf.d/default.conf,以本站为例,配置文件如下:
每次修改完配置文件后,都记得执行下面的命令测试配置文件正确性:
--------------------------------------分割线--------------------------------------
知数堂 (http://zhishuedu.com)培训是由资深MySQL专家叶金荣、吴炳锡联合推出的专业优质培训品牌,主要有MySQL DBA实战优化和Python运维开发课程,是业内最有良心、最有品质的培训课程。
本次部署环境基于CentOS 6.3 x86_64系统。
0. 准备工作
#更新yum [root@imysql ~]# yum -y update [root@imysql ~]# yum install libaio-devel.x86_64 #drupal 8.0需要用到curl模块 [root@imysql ~]# yum install curl-devel [root@imysql ~]# yum -y install libpng-devel libjpeg-devel freetype-devel gmp-devel libxml2-devel1. 安装nginx
#安装nginx官方yum源包 [root@imysql ~]# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm [root@imysql ~]# yum -y install nginx [root@imysql ~]# chkconfig nginx on2. 安装php-fpm
#安装php yum源包 [root@imysql ~]# rpm -ivh rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm [root@imysql ~]# yum -y install php54w3. 配置nginx+php
/etc/nginx/nginx.conf 配置文件可以不用做任何修改。
编辑 /etc/nginx/conf.d/default.conf,以本站为例,配置文件如下:
server { listen 80; server_name imysql.com *.imysql.com; root /data/www/imysql.cn/; index index.php index.htm index.html index.shtml; error_page 404 /page_not_found; error_page 500 502 503 504 /page_not_found; location ~ /\.ht { deny all; } if ($fastcgi_script_name ~ \..*\/.*php) { return 403; } location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } location ^~ /sites/default/files/imagecache/ { index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; break; } } }上述配置包括了nginx虚拟主机的配置,以及drupal的rewrite规则配置,简单快速。4. 启动测试
每次修改完配置文件后,都记得执行下面的命令测试配置文件正确性:
[root@imysql ~]# /etc/init.d/nginx configtest nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful确认配置文件无误后,执行下面的命令重载nginx,使其生效:
[root@imysql ~]# /etc/init.d/nginx reload #或者restart [root@imysql ~]# /etc/init.d/nginx restart大功告成 :)
--------------------------------------分割线--------------------------------------
知数堂 (http://zhishuedu.com)培训是由资深MySQL专家叶金荣、吴炳锡联合推出的专业优质培训品牌,主要有MySQL DBA实战优化和Python运维开发课程,是业内最有良心、最有品质的培训课程。
相关文章推荐
- CentOS 6.3下nginx、php-fpm、drupal快速部署
- centos7.2环境yum方式快速搭建lnmp环境nginx+mariadb+php-fpm
- centos6 一键配置部署nginx php-fpm redis httpsqs
- centos7.2环境yum方式快速搭建lnmp环境nginx+mariadb+php-fpm
- 1分钟完美安装最新 CentOS + Nginx + PHP-FPM + MySQL
- 1分钟完美安装 CentOS + Nginx + PHP-FPM + MySQL
- CentOS6.4安装配置nginx+pcre+php/fpm
- CentOS 6.1 环境中部署nginx、php(包括fastcgi)、虚拟主机配置
- Centos6.2实战部署Nginx+MySQL+PHP
- Centos Yum Nginx Php-fpm Mysql
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 1分钟完美安装最新 CentOS + Nginx + PHP-FPM + MySQL
- 1分钟完美安装最新 CentOS + Nginx + PHP-FPM + MySQL
- centos 安装php-fpm , nginx二级域名配置 ,但为什么必须要 域名提供商 哪里解析新的二级域名一下 才能用呢?
- Centos6.2实战部署Nginx+MySQL+PHP
- centos6.3 yum安装nginx+mysql+php-fpm
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 安装Nginx与使用PHP5(和PHP-FPM Nginx)和MySQL在 CentOS支持6.0的支持
- Centos 6通过YUM源安装nginx+mysql+php-fpm+eaccelerator
- CentOS使用YUM安装php运行环境,包含php,php-fpm,nginx,mysql