Quick deployment of nginx, php-fpm, and drupal in CentOS 6.3

Source: Internet
Author: User
Tags drupal

Everything is based on the principle of simplicity, yum/rpm, and never compiled manually :)
The deployment environment is based on the CentOS 6.3 x86_64 system.
0. Preparations

# Update yum [root @ imysql ~] # Yum-y update [root @ imysql ~] # Yum install libaio-devel.x86_64 # drupal 8.0 requires curl module [root @ imysql ~] # Yum install curl-devel [root @ imysql ~] # Yum-y install libpng-devel libjpeg-devel freetype-devel gmp-devel libxml2-devel

1. Install nginx

# Install the official nginx yum source package [root @ imysql ~] # Rpm-ivh restart ~] # Yum-y install nginx [root @ imysql ~] # Chkconfig nginx on

2. install php-fpm

# Install the php yum source package [root @ imysql ~] # Rpm-ivh rpm-Uvh http://repo.webtatic.com/yum/el6/latest.rpm?root@imysql ~] # Yum-y install php54w

3. Configure nginx + php
The/etc/nginx. conf configuration file does not need to be modified.
Edit/etc/nginx/conf. d/default. conf. Take this site as an example. The configuration file is as follows:

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;        }    }}

The above configuration includes the configuration of the nginx virtual host and the rewrite rule configuration of drupal, which is simple and fast.

4. Start the test
After modifying the configuration file, remember to run the following command to test the correctness of the configuration file:

[root@imysql ~]# /etc/init.d/nginx configtestnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful

After confirming that the configuration file is correct, run the following command to reload nginx to make it take effect:

[Root @ imysql ~] #/Etc/init. d/nginx reload # or restart [root @ imysql ~] #/Etc/init. d/nginx restart

Success :)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.