您的位置:首页 > 运维架构 > Nginx

SUSE11安装NginxMongoSybasePHP环境

2014-04-24 13:45 393 查看

SUSE11安装NginxMongoSybasePHP环境

1.Server

vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
zypper ar http://download.opensuse.org/distribution/11.4/repo/oss/ official
zypper refresh
zypper install pcre-devel // nginx
zypper install zlib // nginx
zypper install zlib-devel //nginx
mkdir /ndap
mkdir /ndap/_run
mkdir /ndap_log
mkdir /ndap/software
mkdir /ndap/mongodb
mkdir /ndap/mongodb/data
mkdir /ndap/mongodb/mongo
mkdir /ndap/www
mkdir /home/sybase
useradd mongodb
groupadd mongodb
useradd www
groupadd www
useradd sybase
groupadd sybase
chown -R mongodb /ndap/mongodb
chgrp -R mongodb /ndap/mongodb

1.1 重启命令

[Nginx]
kill -HUP `cat /ndap/_run/nginx.pid`
[PHP-FPM]
kill -USR2 `cat /ndap/_run/php-fpm.pid`
[MongoDB]
mongo 127.0.0.1:5017
use admin
db.auth("acc","pwd")
db.shutdownServer();

2.MongoDB

cd /ndap/software
wget http://fastdl.mongodb.org/src/mongodb-src-r2.4.9.tar.gz tar -zxvf mongodb-src-r2.4.9.tar.gz
cp -R mongodb-src-r2.4.9/ /ndap/mongodb
vi /ndap/mongodb/mongod.conf
vi /etc/rc.d/boot.local


3.Sybase

- 不再赘述

4.Nginx

cd /ndap/software
wget http://nginx.org/download/nginx-1.5.13.tar.gz tar -xzvf nginx-1.5.13.tar.gz
cd nginx-1.5.13
./configure --prefix=/usr/local/nginx
make
make install
vi /usr/local/nginx/conf/nginx.conf
mkdir /usr/local/nginx/conf/vhost
vi /usr/local/nginx/conf/vhost/ndap.conf

5.PHP

cd /ndap/software
wget http://am1.php.net/get/php-5.3.28.tar.gz/from/this/mirror tar -xzvf php-5.3.28.tar.gz
cd php-5.3.28
'./configure' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc' '--with-iconv-dir=/usr/local' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-safe-mode' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--with-curlwrappers' '--enable-mbregex' '--enable-fpm' '--enable-force-cgi-redirect' '--enable-mbstring' '--with-mcrypt' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-zip' '--with-iconv=/usr/local/libiconv' '--with-sybase-ct=/home/sybase'
make
make install

5.1 PHP Mongo Driver 编译安装

https://github.com/mongodb/mongo-php-driver
tar zxvf mongodb-mongodb-php-driver-xxxx x.tar.gz
cd mongodb-mongodb-php-driver-xxxx
phpize
./configure
sudo make install
vi php.ini # extension=mongo.so

5.2 或者 PECL

pecl install mongo

5.3 其他库

pecl install pecl-http
pecl install mailparse

6.ConfigFiles

6.1 boot.local

limit -SHn 65535
mongod -f /ndap/mongodb/mongo/mongod.conf --quiet
/usr/local/nginx/sbin/nginx
/usr/local/php/sbin/php-fpm
route add default gw 192.168.111.1


6.2 mongod.conf

# mongo.conf

#where to log
logpath=/ndap/_log/mongod.log

logappend=true

# fork and run in background
fork = true

#port = 27017
port = 5017
maxConns=20000

dbpath=/ndap/mongodb/data

# location of pidfile
pidfilepath = /ndap/_run/mongod.pid

# Disables write-ahead journaling
# nojournal = true

# Enables periodic logging of CPU utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true
auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#diaglog = 0

# Ignore query hints
#nohints = true

# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true

# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true

# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true

# Disable data file preallocation.
#noprealloc = true

# Specify .ns file size for new databases.
# nssize = <size>

# Accout token for Mongo monitoring server.
#mms-token = <token>

# Server name for Mongo monitoring server.
#mms-name = <server-name>

# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options

# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com

6.3 /usr/local/nginx/conf/nginx.conf

user  www www;
worker_processes  8;

error_log  /ndap/_log/nginx_error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;
pid     /ndap/_run/nginx.pid;

worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}

http {
include       mime.types;
default_type  application/octet-stream;

charset  utf-8;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 200m;

sendfile on;
tcp_nopush     on;

resolver 127.0.0.1;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css application/xml;
gzip_vary on;

include vhost/*.conf;

}


6.4 /usr/local/nginx/conf/vhost/ndap.conf

server
{
listen         80;
listen         8081 default_server;
server_name    ndap.myt.com;
index index.html index.php;
root    /ndap/www/ndap;
autoindex off;
charset utf-8;
error_page 404  Index/404.html;

location / {
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SYBASE /home/sybase;
include fastcgi.conf;
}

location ~ index\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php?IF_REWRITE=1;
fastcgi_param SYBASE /home/sybase;
include fastcgi.conf;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME /ndap/www/ndap/index.php;
fastcgi_param SCRIPT_NAME "";
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires            1s;
}

location ~ .*\.(js|css)?$
{
expires            1s;
}

}

6.5 /usr/local/php/etc/php.ini

[PHP]
max_input_vars = 100000;
error_log = /ndap/_log/php.log
post_max_size = 20M
upload_max_filesize = 20M
max_file_uploads = 20
extension=raphf.so
extension=propro.so
extension=http.so
extension="mailparse.so"
extension=mongo.so

[sybase]
SYBASE="/home/sybase"

[mongo]
mongo.native_long = "1"


4000
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SUSE NGINX PHP MONGODB SYBASE