1.Installation
1.1. download lasted repo
#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm1.2. install new repo file
#wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#rpm -Uvh remi-release-*.rpm epel-release-*.rpm
1.3.create nginx repo #vi /etc/yum.repos.d/nginx.repo
1.4.install package
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum --enablerepo=remi,remi-test install nginx php php-fpm php-common php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml php-devel
2.Configuration
2.1 การสร้าง config สำหรับ nginx
สร้าง folder sites-available, sites-enabled โดยที่ folder sites-available จะใช้เก็บข้อมูลของ site ทั้งหมดที่เรา config ไว้ ส่วน sites-enabled จะใช้เก็บ symbolic links ที่ชี้ไปหาใน folder sites-available (โดยถ้าจะเปิดให้ บริการที่ site ไหน ก็สร้าง symbolic links ไปเก็บไว้ที่ sites-enabled)
ในไฟล์ /etc/nginx/nginx.conf
worker_processes 1; <--- แก้ไขให้เท่ากับ cpu core โดยใช้ lscpu ดูในส่วน "CPU(s):"
#include /etc/nginx/conf.d/*.conf; <--- add # comment
include /etc/nginx/sites-enabled/*; <----- add line
2.2 การสร้าง virtual host
vi /etc/nginx/sites-available/my_host_config.conf
ข้างล่างนี้เป็นตัวอย่าง config ครับ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name miiniq.com; | |
location = /robots.txt { access_log off; log_not_found off; } | |
location ~ ~$ { access_log off; log_not_found off; deny all; } | |
location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ { | |
add_header Pragma "public"; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
access_log off; | |
log_not_found off; | |
expires 360d; | |
} | |
location / { | |
index index.html index.php; | |
try_files $uri /index.php?$args; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /var/www/html; | |
} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /.ht { | |
deny all; | |
access_log off; | |
log_not_found off; | |
} |
3.OCI8 download and Install
3.1 download oci8
3.2 download oracle sdk http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.htmlmkdir -p /opt/oracle/src/cd /opt/oracle/src/wget http://pecl.php.net/get/oci8-1.4.9.tgz (http://pecl.php.net/package/oci8)tar -zxvf oci8-1.4.9.tgzcd oci8-1.4.9phpize (อยู่ใน php-devel)
โดยโหลด instantclient-sdk-linux.x64-11.2.0.3.0.zip,instantclient-basic-linux.x64-11.2.0.3.0.zip จากนั้น unzip ไว้ใน filder /opt/oracle/instantclient และทำ sybolic link
ln -s /usr/lib/oracle/instantclient//libclntsh.so.*.1 libclntsh.so3.3 make oci8
cd /opt/oracle/src/./configure –with-oci8=instantclient,/opt/oracle/instantclientmakemake install
3.4 add mod oci8 ใน php.ini
extension=oci8.so
Ref : https://www.mellzamora.com/install-nginx-php-5-4-php-fpm-on-centos6/
Ref : http://rivenlinux.info/how-to-install-oci8-and-instantclient-on-linux/
0 ความคิดเห็น:
แสดงความคิดเห็น