OpenShift Build Nginx+php5.2+zend+mysql Server Tutorial

Source: Internet
Author: User
Keywords Server

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Recently applied for OpenShift PAAs space, very domineering support n languages, as well as the use of the two said, the space application of the tutorial is not listed in this article, interested comrades can be released later this site another article in the detailed introduction, This article is based on you have obtained OpenShift account and Space authority, and has completed the download and installation of OpenShift management software, OK, no more nonsense to say, the opening.

This article actually set up a number of blog about the establishment of OpenShift, and then set up some of my special needs, such as Zend Support, and PHP version of the 5.2.17,5.3 version of this is not discussed directly a command can be established at the command prompt cmd window input: RHC app Create php5.3 name, where name is the name of the application you want to create, and then the domain name starts with this, and then the MySQL database is added to the Web admin interface.

First build the nginx1.2 server, the following operations are performed under the SSH command window:

CD $OPENSHIFT _data_dir

wget http://nginx.org/download/nginx-1.2.2.tar.gz

Tar zxf nginx-1.2.2.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.bz2

Tar jxf pcre-8.31.tar.bz2

#开始编译nginx

MakeDir nginx1.2

CD nginx-1.2.2

./configure--with-pcre= $OPENSHIFT _data_dir/pcre-8.31--prefix= $OPENSHIFT _data_dir/nginx1.2

Make

Make install

CD $OPENSHIFT _data_dir

#配置NGINX

Vim nginx1.2/conf/nginx.conf

Edit the bottom content:

HTTP {...

server {

Listen 127.7.192.129:8080;

server_name 127.7.192.129;

...

}

...

}

The IP and port of Listen and server_name are respectively by Echo $OPENSHIFT _diy_ip, Echo $OPENSHIFT _diy_port

Get

Location/{

root HTML;

Index index.php index.html index.htm;

}

To change the root directory of the site please modify the root HTML (HTML is the site root directory path, modify to the actual path), and add index.php to index, the server will automatically identify with the PHP end of the home page, or there may be a 404 error, where HTML by $ Openshift_repo_dir/diy;

To enable nginx support for PHP, remove the comments for the following fragment and

Location ~ php$ {

Root $OPENSHIFT _repo_dir/diy;

Fastcgi_pass $OPENSHIFT _diy_ip:9000;

Fastcgi_index index.php;

Include fastcgi.conf;

}

$OPENSHIFT _repo_dir, $OPENSHIFT _diy_ip to fill in their own specific values, the port number of the default 9000 can also be arbitrarily specified, large enough, but to remember Oh, the following configuration will be used.

In addition, please killall Ruby before starting Nginx, or it will fail due to port occupancy

First, create start.sh and restart.sh in the $openshift_data_dir/nginx.1.2 directory, using the command

Vim start.sh #输入以下内容后, the ESC key exits edit, enter: Wq can save exit (contain colon).

start.sh content is

#!/bin/bash

# start Nginx

Killall Ruby

$OPENSHIFT _data_dir/nginx1.2/sbin/nginx

Once the start.sh is established,

Vim restart.sh #输入以下内容, the ESC key exits edit, enter: Wq can save exit (contain colon).

restart.sh content is

#!/bin/bash

# Restart Nginx

Killall Ruby

Killall Nginx

$OPENSHIFT _data_dir/nginx1.2/sbin/nginx

Never forget to give start.sh and restart.sh executable permissions:

chmod +x start.sh restart.sh

Join at the start end of the ~/app-root/repo/.openshift/action_hooks directory

$OPENSHIFT _data_dir/nginx1.2/start.sh

So Nginx built, in the nginx1.2 path input command restart.sh, enter a URL does not exist, if you see the Nginx 404 page shows that you succeeded.

This article link: http://www.kxzhp.com/info/2013/11/26/9.html

The following begins to compile php5.2.17, as for 5.2 detailed version with you, 17 is the last version of 5.2.

wget http://museum.php.net/php5/php-5.2.17.tar.gz

wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz

mkdir PHP5.2

Tar zxf php-5.2.17.tar.gz

GZIP-CD php-5.2.17-fpm-0.5.14.diff.gz | Patch-d PHP-5.2.17-P1

CD php-5.2.17

./configure--with-mysql=/var/lib/openshift/user/mysql--prefix= $OPENSHIFT _data_dir/php5.2--enable-fpm

--enable-mbstring--with-zlib--enabl

E-xml--enable-bcmath--with-curl--with-gd--enable-zip--enable-sockets--with-libdir=lib64--with-png

-DIR=/USR--with-jpeg-dir=/usr--with-config-file-path= $OPENSHIFT _data_dir/php5.5/etc--with-pcre--enable-fastcgi

#要将mysql中的user换成自己的id, it takes about half an hour to compile, depending on your speed.

Make

Make install

#又是半小时 to one hours = =, the following is the file Php.ini-dist file copy and renamed to php.ini file

CP php.ini-dist $OPENSHIFT _data_dir/php5.2/etc/php.ini

Below to configure PHP-FPM, this article links: http://www.kxzhp.com/info/2013/11/26/9.html

Vim $OPENSHIFT _data_dir/php5.2/etc/php-fpm.conf

The label listen_address is the IP address and port on which the FASTCGI process is configured to monitor, and the default is 127.0.0.1:9000.

$OPENSHIFT _diy_ip:9000, $OPENSHIFT _diy_ip to fill in its own specific value, the port will be configured with PHP in the Nginx port.

The label allowed_clients is used to set the IP address that allows access to the FASTCGI process parser. If you do not specify an IP address here, the PHP resolution request forwarded by NGINX will not be accepted.

127.0.0.1, $OPENSHIFT _ip_diy, $OPENSHIFT _ip_diy fill in their own specific values, be sure to add their own IP values, or you will not be able to parse php script, 404 errors occurred.

and add in the $openshift_data_dir/nginx1.2/restart.sh

$OPENSHIFT _data_dir/php5.5/sbin/php-fpm Restart

Execute restart.sh,nginx+php configuration is done.

Finally, add the Zend Optimizer extension to support programs that have been encrypted with Zend,

CD $OPENSHIFT _data_dir

wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

Tar zxf zendoptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

CP zendoptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/zendoptimizer.so $OPENSHIFT _DATA_DIR/PHP5.2/ Zendoptimizer.so

VI $OPENSHIFT _data_dir/php5.2/etc/php.ini

Add at end of file

[Zendoptimizer]

Zend_optimizer.optimization_level=1

zend_extension= "$OPENSHIFT _data_dir/php5.5/zendoptimizer.so"

Here the $openshift_data_dir to fill in their own specific path, the implementation of nginx1.2 in the restart.sh, upload probe to verify Zend Optimizer installation

Successful, this article probes address http://diy11-kxzhp.rhcloud.com/tz.php

Related Article

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.