nohup python web_server.py &
1.安装ez_setup.py
su root
wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
2.安装MySQL-python
安装mysql相关:
yum install mysql*
安装MySQL-python
yum install python*
3.
export C_INCLUDE_PATH=/usr/include/mysql/
yum install mysql mysql-devel
easy_install -U MySQL-python
wget http://pypi.python.org/packages/source/D/DBUtils/DBUtils-1.1.tar.gz#md5=aa13d60db0377234c5f9469212da5022
tar -vxf DBUtils-1.1.tar.gz
cd DBUtils-1.1
python setup.py install
4.安装Django
easy_install django==1.3
5.安装tornado
easy_install tornado
6.运行项目
python web_server.py
7.安装ngnix
--yum 安装 nginx
cd /etc/yum.repos.d/
vim nginx.repo
--输入:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install nginx
8.配置Ngnix
在ngnix安装目录里面新建server目录。
nginx.conf:
user nginx nginx;
worker_processes 1;
worker_cpu_affinity 00000001;
error_log /huiwanba/logs/nginx_error.log crit;
pid /huiwanba/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
log_format access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$request_time"';
access_log off;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 9;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
#upstream.conf
error_page 403 http://www.inforcn.com/error/?e=403;
error_page 404 http://www.inforcn.com/error/?e=404;
error_page 405 http://www.inforcn.com/error/?e=405;
error_page 500 http://www.inforcn.com/error/?e=500;
error_page 501 http://www.inforcn.com/error/?e=501;
error_page 502 http://www.inforcn.com/error/?e=502;
error_page 503 http://www.inforcn.com/error/?e=503;
server {
location /NginxStatus/ {
stub_status on;
access_log off;
allow 192.168.0.241;
deny all;
}
}
include /etc/nginx/server/*;
}
server目录里面新建文件,名为www.huiwanba.com.conf
www.huiwanba.com.conf:
upstream apiclient {
server 127.0.0.1:8092;
}
server
{
listen 80;
server_name www.huiwanba.com;
access_log /huiwanba/logs/huiwanba.com.log;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://apiclient;
proxy_next_upstream error;
}
}
nginx -t
nginx -s reload
9.安装MySql
1.yum -y install mysql-server
2.yum -y install php-mysql
3.chkconfig mysqld on
4.chkconfig --list mysqld
5./etc/rc.d/init.d/mysqld start
6.mysql -u root
7.set password for root@localhost=password('root');
8.grant all privileges on *.* to root@"%" identified by 'huiwanba_db'
1.安装java环境
jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tar -zxvf jdk-7u17-linux-i586.tar.gz
vim /etc/profile
export JAVA_HOME=/home/sigangjun/program/jdk1.7.0_17
export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
2.配置eclips
tar -zxvf eclipse-jee-juno-SR2-linux-gtk.tar.gz
cd eclips
./eclips
安装svn:
http://subclipse.tigris.org/update_1.6.x
安装python:
http://pydev.org/updates/
daemonize="false"
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=10 \
maxspare=5 minspare=2 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
client_body_temp_path /data/comment_center/HTTPDataServer/log/client_body_temp;
proxy_temp_path /data/comment_center/HTTPDataServer/log/proxy_temp;
fastcgi_temp_path /data/comment_center/HTTPDataServer/log/fastcgi_temp;
1. 安装 nginx yum 安装
2. 装 flup
3. 修改 nginx.conf
4. 启动
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=128 \
maxspare=5 minspare=2 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
kill `cat $PIDFILE`
-- 评论重启 ---
cd /data/comment_center/HTTPDataServer/
ps -ef |grep comment_center |grep -v grep |awk '{print $2}' |xargs kill -9
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
chmod 777 com_center.socket
cd /
-- 统计重启 ----
cd /data/StatStorage/HTTPDataServer
ps -ef |grep StatStorage |grep -v grep |awk '{print $2}' |xargs kill -9
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/data/StatStorage/HTTPDataServer/com_center.socket pidfile=/data/StatStorage/HTTPDataServer/django.pid
chmod 777 com_center.socket
cd /data/StatStorage/HTTPDataServer
server {
listen 80;
server_name localhost;
access_log /data/comment_center/HTTPDataServer/access_log.log;
location / {
fastcgi_pass unix:/data/comment_center/HTTPDataServer/com_center.socket;
# for a TCP host/port:
# fastcgi_pass {hostname}:{port};
# necessary parameter
fastcgi_param PATH_INFO $fastcgi_script_name;
# to deal with POST requests
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
# http://stackoverflow.com/questions/605173/how-to-nginx-virtual-servers-fcgi-for-django uses many other parameters,
# some may be necessary in some situations
}
}
fastcgj
重启
ps -ef |grep huiwanba |grep -v grep |awk '{print $2}' |xargs kill -9
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
chmod 777 /huiwanba/logs/*
nginx -s reload
启动
mount /dev/xvdb /huiwanba/
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
nginx
nginx -s reload
svn:
svn checkout svn://inforcn.com/repos/svnroot/product/03huiwanba/huiwanba
svn update /huiwanba/www/aaa/huiwanba
ps -ef |grep huiwanba |grep -v grep |awk '{print $2}' |xargs kill -9
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
chmod 777 /huiwanba/logs/*
nginx -s reload
1.安装ez_setup.py
su root
wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
2.安装MySQL-python
安装mysql相关:
yum install mysql*
安装MySQL-python
yum install python*
3.
export C_INCLUDE_PATH=/usr/include/mysql/
yum install mysql mysql-devel
easy_install -U MySQL-python
wget http://pypi.python.org/packages/source/D/DBUtils/DBUtils-1.1.tar.gz#md5=aa13d60db0377234c5f9469212da5022
tar -vxf DBUtils-1.1.tar.gz
cd DBUtils-1.1
python setup.py install
4.安装Django
easy_install django==1.3
5.安装tornado
easy_install tornado
6.运行项目
python web_server.py
7.安装ngnix
--yum 安装 nginx
cd /etc/yum.repos.d/
vim nginx.repo
--输入:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install nginx
8.配置Ngnix
在ngnix安装目录里面新建server目录。
nginx.conf:
user nginx nginx;
worker_processes 1;
worker_cpu_affinity 00000001;
error_log /huiwanba/logs/nginx_error.log crit;
pid /huiwanba/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
log_format access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$request_time"';
access_log off;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 9;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
#upstream.conf
error_page 403 http://www.inforcn.com/error/?e=403;
error_page 404 http://www.inforcn.com/error/?e=404;
error_page 405 http://www.inforcn.com/error/?e=405;
error_page 500 http://www.inforcn.com/error/?e=500;
error_page 501 http://www.inforcn.com/error/?e=501;
error_page 502 http://www.inforcn.com/error/?e=502;
error_page 503 http://www.inforcn.com/error/?e=503;
server {
location /NginxStatus/ {
stub_status on;
access_log off;
allow 192.168.0.241;
deny all;
}
}
include /etc/nginx/server/*;
}
server目录里面新建文件,名为www.huiwanba.com.conf
www.huiwanba.com.conf:
upstream apiclient {
server 127.0.0.1:8092;
}
server
{
listen 80;
server_name www.huiwanba.com;
access_log /huiwanba/logs/huiwanba.com.log;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://apiclient;
proxy_next_upstream error;
}
}
nginx -t
nginx -s reload
9.安装MySql
1.yum -y install mysql-server
2.yum -y install php-mysql
3.chkconfig mysqld on
4.chkconfig --list mysqld
5./etc/rc.d/init.d/mysqld start
6.mysql -u root
7.set password for root@localhost=password('root');
8.grant all privileges on *.* to root@"%" identified by 'huiwanba_db'
1.安装java环境
jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tar -zxvf jdk-7u17-linux-i586.tar.gz
vim /etc/profile
export JAVA_HOME=/home/sigangjun/program/jdk1.7.0_17
export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
2.配置eclips
tar -zxvf eclipse-jee-juno-SR2-linux-gtk.tar.gz
cd eclips
./eclips
安装svn:
http://subclipse.tigris.org/update_1.6.x
安装python:
http://pydev.org/updates/
daemonize="false"
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=10 \
maxspare=5 minspare=2 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
client_body_temp_path /data/comment_center/HTTPDataServer/log/client_body_temp;
proxy_temp_path /data/comment_center/HTTPDataServer/log/proxy_temp;
fastcgi_temp_path /data/comment_center/HTTPDataServer/log/fastcgi_temp;
1. 安装 nginx yum 安装
2. 装 flup
3. 修改 nginx.conf
4. 启动
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=128 \
maxspare=5 minspare=2 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
kill `cat $PIDFILE`
-- 评论重启 ---
cd /data/comment_center/HTTPDataServer/
ps -ef |grep comment_center |grep -v grep |awk '{print $2}' |xargs kill -9
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/data/comment_center/HTTPDataServer/com_center.socket pidfile=/data/comment_center/HTTPDataServer/django.pid
chmod 777 com_center.socket
cd /
-- 统计重启 ----
cd /data/StatStorage/HTTPDataServer
ps -ef |grep StatStorage |grep -v grep |awk '{print $2}' |xargs kill -9
python ./manage.py runfcgi --settings=HTTPDataServer.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/data/StatStorage/HTTPDataServer/com_center.socket pidfile=/data/StatStorage/HTTPDataServer/django.pid
chmod 777 com_center.socket
cd /data/StatStorage/HTTPDataServer
server {
listen 80;
server_name localhost;
access_log /data/comment_center/HTTPDataServer/access_log.log;
location / {
fastcgi_pass unix:/data/comment_center/HTTPDataServer/com_center.socket;
# for a TCP host/port:
# fastcgi_pass {hostname}:{port};
# necessary parameter
fastcgi_param PATH_INFO $fastcgi_script_name;
# to deal with POST requests
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
# http://stackoverflow.com/questions/605173/how-to-nginx-virtual-servers-fcgi-for-django uses many other parameters,
# some may be necessary in some situations
}
}
fastcgj
重启
ps -ef |grep huiwanba |grep -v grep |awk '{print $2}' |xargs kill -9
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
chmod 777 /huiwanba/logs/*
nginx -s reload
启动
mount /dev/xvdb /huiwanba/
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
nginx
nginx -s reload
svn:
svn checkout svn://inforcn.com/repos/svnroot/product/03huiwanba/huiwanba
svn update /huiwanba/www/aaa/huiwanba
ps -ef |grep huiwanba |grep -v grep |awk '{print $2}' |xargs kill -9
python /huiwanba/www/aaa/huiwanba/manage.py runfcgi --settings=huiwanba.settings maxchildren=8 maxspare=8 minspare=4 method=prefork socket=/huiwanba/logs/com_center.socket pidfile=/huiwanba/logs/django.pid
nginx -t
chmod 777 /huiwanba/logs/*
nginx -s reload