Thứ Sáu, 11 tháng 12, 2015

Hướng Dẫn Gộp Gear Openshift Và Cấu Hình Phpmyadmin

Sản phẩm sau khi gộp gear là 3GB dung lượng và 1.5GB ram (chưa kiểm chứng) - Đầu tiên mình đăng kí 1 tài khoản OPENSHIFT, các bạn không thích đăng kí mới thì delete hết app trong tài khoản để thực hiện gộp gear. - Create app với PHP 5.3
Scaling bạn chọn Scale with web traffic rồi create app như bình thường.
Tiếp đến bạn vào app vừa tạo chỉnh gear thành 2x để có 2gb dung lượng ổ đĩa

ADD A CARTRIDGE
MySQL Database 5.1
*Bước này thì các bạn add như bình thường, nhớ lưu lại ID&PASSWD root mysql không là thôi luôn đó.
*Giờ bạn đã có mysql chạy trên 1 gear và 2gear kia chạy code, tổng là 3GB rồi nhé. 

#Cấu hình phpmyadmin

bạn vào trang chủ 'http://www.phpmyadmin.net'download phpmyadmin rồi upload lên thư mục php. Giải nén ra bạn đc thư mục phpmyadmin*
Bạn vào thư mục vừa giải nén sửa file config.sample.inc.php
File config.sample.inc.php phải đổi tên thành config.inc.php
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Sửa thành:
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'DIA-CHI';
$cfg['Servers'][$i]['port'] = 'PORT';
$cfg['Servers'][$i]['socket'] = getenv('OPENSHIFT_MYSQL_DB_SOCKET');
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
DIA-CHI bạn lấy ở file OPENSHIFT_MYSQL_DB_HOST
PORT 
bạn lấy ở file OPENSHIFT_MYSQL_DB_PORT
nó nằm ở /var/lib/openshift/52482eaa4382ecc22000009c/.env/mysql
ví dụ của mình có dạng:
Mã:
5248312c4382ecc86a00004c-blogvn.rhcloud.com
43611
Sau khi sửa
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = '5248312c4382ecc86a00004c-blogvn.rhcloud.com';
$cfg['Servers'][$i]['port'] = '43611';
$cfg['Servers'][$i]['socket'] = getenv('OPENSHIFT_MYSQL_DB_SOCKET');
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
bạn save lại, đổi tên thành config.inc.php rồi chạy domain/phpmyadmin xem nào. ID&PASSWD là lúc create mysql.
*hoàn thành phpmyadmin
////////////////////
Tiếp đến làm thế nào không bị 503 Service Unavailable
Theo nghiên cứu của mình thì khi xóa file index.php là bị như thế, bạn đừng lo, cứ unzip code rồi cài đặt như bình thường, sau đó tại 1 file index.html
thêm code này vào .htaccess
Mã:
DirectoryIndex index.php
tiếp đến bạn xóa index.html đi đc rồi đó, truy cập site xem


Sản phẩm sau khi gộp gear là 3GB dung lượng và 1.5GB ram (chưa kiểm chứng) - Đầu tiên mình đăng kí 1 tài khoản OPENSHIFT, các bạn không thích đăng kí mới thì delete hết app trong tài khoản để thực hiện gộp gear. - Create app với PHP 5.3
Scaling bạn chọn Scale with web traffic rồi create app như bình thường.
Tiếp đến bạn vào app vừa tạo chỉnh gear thành 2x để có 2gb dung lượng ổ đĩa

ADD A CARTRIDGE
MySQL Database 5.1
*Bước này thì các bạn add như bình thường, nhớ lưu lại ID&PASSWD root mysql không là thôi luôn đó.
*Giờ bạn đã có mysql chạy trên 1 gear và 2gear kia chạy code, tổng là 3GB rồi nhé. 

#Cấu hình phpmyadmin

bạn vào trang chủ 'http://www.phpmyadmin.net'download phpmyadmin rồi upload lên thư mục php. Giải nén ra bạn đc thư mục phpmyadmin*
Bạn vào thư mục vừa giải nén sửa file config.sample.inc.php
File config.sample.inc.php phải đổi tên thành config.inc.php
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Sửa thành:
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'DIA-CHI';
$cfg['Servers'][$i]['port'] = 'PORT';
$cfg['Servers'][$i]['socket'] = getenv('OPENSHIFT_MYSQL_DB_SOCKET');
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
DIA-CHI bạn lấy ở file OPENSHIFT_MYSQL_DB_HOST
PORT 
bạn lấy ở file OPENSHIFT_MYSQL_DB_PORT
nó nằm ở /var/lib/openshift/52482eaa4382ecc22000009c/.env/mysql
ví dụ của mình có dạng:
Mã:
5248312c4382ecc86a00004c-blogvn.rhcloud.com
43611
Sau khi sửa
Mã:
/* Server parameters */
$cfg['Servers'][$i]['host'] = '5248312c4382ecc86a00004c-blogvn.rhcloud.com';
$cfg['Servers'][$i]['port'] = '43611';
$cfg['Servers'][$i]['socket'] = getenv('OPENSHIFT_MYSQL_DB_SOCKET');
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
bạn save lại, đổi tên thành config.inc.php rồi chạy domain/phpmyadmin xem nào. ID&PASSWD là lúc create mysql.
*hoàn thành phpmyadmin
////////////////////
Tiếp đến làm thế nào không bị 503 Service Unavailable
Theo nghiên cứu của mình thì khi xóa file index.php là bị như thế, bạn đừng lo, cứ unzip code rồi cài đặt như bình thường, sau đó tại 1 file index.html
thêm code này vào .htaccess
Mã:
DirectoryIndex index.php
tiếp đến bạn xóa index.html đi đc rồi đó, truy cập site xem

0 nhận xét:

Đăng nhận xét