Recently, I applied for the paas space of openshift. I am very domineering to support n languages. I just want to talk about it if I don't need it. the space application tutorial is not listed in this article, interested comrades can give a detailed introduction in another article released later on this site. This article is based on the opensh
Recently, I applied for the paas space of openshift. I am very domineering to support n languages. I just want to talk about it if I don't need it. the space application tutorial is not listed in this article, interested comrades can give a detailed introduction in another article released later on this site. This article is based on the fact that you have obtained the openshift account and space permissions, the openshift management software has been downloaded and installed.
In fact, this article has collected a number of blog posts on the establishment of openshift and some special requirements, such as zend support and php version 5.2.17, in version 5.3, you do not need to discuss how to create a command directly. in the command prompt cmd window, enter: rhc app create php5.3 name, where name indicates the name of the application you want to create. in the future, the domain name will start with this, then, enter the web management interface to add a mysql database.
First, build the nginx1.2 server, and execute the following operations in 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
# Start compiling 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
# Configure NGINX
Vim nginx1.2/conf/nginx. conf
Edit the following 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 composed of echo $ OPENSHIFT_DIY_IP and echo $ OPENSHIFT_DIY_PORT.
Get
Location /{
Root html;
Index. php index.html index.htm;
}
To change the root directory of a website, modify the root html (html is the root directory path of the website and the actual path) and add the index to the index. in php, the server automatically identifies the homepage ending with php. Otherwise, a 404 error may occur, where html is obtained by $ OPENSHIFT_REPO_DIR/diy;
To enable nginx to support php, remove the comments from the following snippets 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 must fill in its own specific value. The default port number 9000 can also be specified. it is large enough, but remember that the following configuration will be used.
In addition, please killall ruby before starting NGINX, otherwise it will fail due to port occupation
First, create start. sh and restart. sh in the $ OPENSHIFT_DATA_DIR/nginx.1.2 directory, and use the command
Vim start. sh # after entering the following content, run esc to exit the editing. enter wq to save and exit (including the colon ).
The start. sh content is
#! /Bin/bash
# Start nginx
Killall ruby
$ OPENSHIFT_DATA_DIR/nginx1.2/sbin/nginx
After Start. sh is created,
Vim restart. sh # enter the following content, and the esc key is used to exit the editing. enter wq to save and exit (including the colon ).
The restart. sh content is
#! /Bin/bash
# Restart nginx
Killall ruby
Killall nginx
$ OPENSHIFT_DATA_DIR/nginx1.2/sbin/nginx
Do not forget to grant the start. sh and restart. sh executable permissions:
Chmod + x start. sh restart. sh
In ~ /App-root/repo/. openshift/action_hooks
$ OPENSHIFT_DATA_DIR/nginx1.2/start. sh
After nginx is set up, enter the command restart. sh in the nginx1.2 path and enter a url that does not exist. if nginx 404 is displayed, you have succeeded.
Link: http://www.kxzhp.com/info/2013/11/26/9.html
Next, we will compile php5.2.17. the detailed version 5.2 will be selected, and 17 will be 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
# Replace user in mysql with your own id! Compilation takes about half an hour, depending on your network speed
Make
Make install
# It ranges from half an hour to one hour ==. The following is to copy and rename the file php. ini-dist to the php. ini file.
Cp php. ini-dist $ OPENSHIFT_DATA_DIR/PHP5.2/etc/php. ini
Below to configure php-fpm, this article link: http://www.kxzhp.com/info/2013/11/26/9.html
Vim $ OPENSHIFT_DATA_DIR/PHP5.2/etc/php-fpm.conf
The listen_address label is the IP address and port configured for fastcgi process listening. the default value is 127.0.0.1: 9000.
$ OPENSHIFT_DIY_IP: 9000, $ OPENSHIFT_DIY_IP must be set to its own specific value. the port must be consistent with the php port configured in nginx.
The label allowed_clients is used to set the IP addresses allowed to access the FastCGI process parser. If the IP address is not specified here, the PHP resolution request forwarded by Nginx will not be accepted.
127.0.0.1, $ OPENSHIFT_IP_DIY, $ OPENSHIFT_IP_DIY fill in the specific value of your own, be sure to add your own ip value, or else you will still be unable to parse the php script, error 404.
Add $ OPENSHIFT_DATA_DIR/nginx1.2/restart. sh
$ OPENSHIFT_DATA_DIR/PHP5.5/sbin/php-fpm restart
Execute restart. sh and nginx + php configuration.
Add Zend optimizer extension to support Zend-encrypted programs,
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
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
[ZendOptimizer]
Zend_optimizer.optimization_level = 1
Zend_extension = "$ OPENSHIFT_DATA_DIR/PHP5.5/ZendOptimizer. so"
Here, $ OPENSHIFT_DATA_DIR needs to fill in its own specific path, execute restart. sh in nginx1.2, upload the probe to verify whether zend optimizer is installed
Successful, this article probe address http://diy11-kxzhp.rhcloud.com/tz.php