狮子金融
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了狮子金融相关的知识,希望对你有一定的参考价值。
nginx反向代理
cat /mnt/usr/local/nginx/conf/nginx.conf
user www www;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
#log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
# ‘$status $body_bytes_sent "$http_referer" ‘
# ‘"$http_user_agent" "$http_x_forwarded_for"‘;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
fastcgi_buffers 32 32k;
fastcgi_buffer_size 128k;
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
client_max_body_size 5m;
server {
listen 80;
server_name www.51lion.com 51lion.com;
rewrite ^(.*)$ https://www.51lion.com$1 permanent;
}
server {
listen 443;
ssl on;
ssl_certificate sslkey/1_www.51lion.com_bundle.crt;
ssl_certificate_key sslkey/2_www.51lion.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:-LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
server_name www.51lion.com 51lion.com;
# rewrite ^(.*)$ https://$host$1 permanent;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http:// https://;
access_log on;
access_log /tmp/51lionaccess.log combined;
error_log /tmp/51lionerror.log;
location / {
proxy_pass http://10.117.73.97:80;
}
location /app {
proxy_pass http://10.117.73.97:84;
}
location /Login {
proxy_pass http://10.117.73.97:8080/Login;
}
location /Login_ss {
proxy_pass http://10.117.73.97:8088/Login_ss;
}
location /LionApp {
proxy_pass http://10.117.73.97:8080/LionApp;
}
location /LionFinancing/ {
proxy_pass http://10.117.73.97:8080/LionFinancing/;
}
location /LionStatistic{
proxy_pass http://10.117.73.97:8080/LionStatistic;
}
location /TradeWebAPI {
proxy_pass http://10.117.73.97:8080/TradeWebAPI;
}
location /ReturnAccountService{
proxy_pass http://10.168.117.2:8080/ReturnAccountService;
}
location /weChat{
proxy_pass http://10.168.117.2:80/weChat;
}
location ^~ /ngx_status {
stub_status on;
access_log off;
}
}
include vhost/*.conf;
}
[[email protected] ~]# cd /mnt/usr/local/nginx/conf/vhost/
[[email protected] vhost]# ls
51lcrm.conf 51lionsmart.conf lionfintech.conf.bak sz.51lion.conf
51lcrm.conf.bak agent51lion.conf news51lion.conf zabbix51lion.conf
51lion.conf.bak api51lion.conf smart51lion.conf
51lion.conf.http czz51lion.conf society.conf
[[email protected] vhost]# cat 51lcrm.conf
server {
listen 80;
server_name 51lcrm.51phm.com;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log on;
access_log /tmp/51lcrmaccess.log combined;
error_log /tmp/51lcrmerror.log;
location / {
# allow 180.168.142.26;
# deny all;
proxy_pass http://10.117.73.97:81;
}
}
[[email protected] vhost]# cat czz51lion.conf
server {
listen 80;
client_max_body_size 5m;
server_name czz.51lion.com;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log on;
access_log /tmp/czz51lionaccess.log combined;
error_log /tmp/czz51lionerror.log;
location / {
proxy_pass http://10.117.57.152:80;
}
location /robot {
proxy_pass http://10.117.57.152:80/robot;
}
}
链接php
[[email protected] vhost]# cat sz.51lion.conf
server {
listen 80;
server_name sz.51lion.com;
index index.php index.html index.htm;
set $root_path ‘/home/wwwroot/51lion‘;
root $root_path;
# try_files $uri $uri/ @rewrite;
location ^~ / {
root html;
index 50x.html index.htm;
# deny all;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
access_log on;
access_log /tmp/sz51lionaccess.log combined;
error_log /tmp/sz51lionerror.log;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /home/wwwroot/51lion;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/wwwroot/51lion$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht {
# deny all;
#}
}
[[email protected] vhost]# cat 51lion.conf.http
server {
listen 80;
client_max_body_size 5m;
server_name www.51lion.com 51lion.com;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log on;
access_log /tmp/51lionaccess.log combined;
error_log /tmp/51lionerror.log;
location / {
proxy_pass http://10.117.73.97:80;
}
location /Login {
proxy_pass http://10.117.73.97:8080/Login;
}
location /LionFinancing {
proxy_pass http://10.117.73.97:8080/LionFinancing;
}
location /LionStatistic{
proxy_pass http://10.117.73.97:8080/LionStatistic;
}
}
apache 配置文件
cat /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/51lion
ServerName www.51lion.com
ErrorLog logs/51lion.com-error_log
CustomLog logs/51lion.com-access_log common
LimitRequestBody 10485760
<Directory "var/www/html/51lion">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:81>
DocumentRoot /var/www/html/51lcrm
ServerName 51lcrm.51phm.com
ErrorLog logs/51lcrm.com-error_log
CustomLog logs/51lcrm.com-access_log common
<Directory "var/www/html/51lcrm">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:82>
DocumentRoot /var/www/html/apiserver
ServerName api.51lion.com
LimitRequestBody 10485760
ErrorLog logs/api51lion.com-error_log
CustomLog logs/api51lion.com-access_log common
<Directory "var/www/html/apiserver">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:83>
DocumentRoot /var/www/html/51lionsmart
ServerName www.51lionsmart.com
ErrorLog logs/51lionsmart.com-error_log
CustomLog logs/51lionsmart.com-access_log common
LimitRequestBody 10485760
<Directory "var/www/html/51lionsmart">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:84>
DocumentRoot /var/www/html/investment
ServerName 120.26.226.177
ErrorLog logs/investment-error_log
CustomLog logs/investmentm-access_log common
<Directory "var/www/html/investment">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:85>
DocumentRoot /var/www/html/acting
ServerName agent.51lion.com
ErrorLog logs/acting-error_log
CustomLog logs/acting-access_log common
<Directory "var/www/html/acting">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 10.168.117.2
Allow from 180.168.142.26
</Location>
发布目录
[[email protected] ~]# ll /var/www/html/
total 253924
drwxr-xr-x 7 root root 4096 Nov 8 16:23 51lcrm
-rw-r--r-- 1 root root 29437228 Nov 8 16:25 51lcrm.tar.tgz
drwxr-xr-x 8 root root 4096 Oct 26 20:37 51lion
drwxr-xr-x 4 root root 4096 Oct 19 15:27 51lionsmart
drwxr-xr-x 7 root root 4096 Sep 26 16:03 acting
drwxr-xr-x 7 root root 4096 Oct 11 10:09 apiserver
drwxr-xr-x 21 root root 4096 Apr 18 2016 framework
drwxr-xr-x 6 root root 4096 Dec 20 18:23 investment
drwxr-xr-x 3 root root 4096 May 19 2016 linfintech
drwxr-xr-x 3 root root 4096 Jul 1 16:12 lionapi
drwxr-xr-x 6 root root 4096 Apr 14 2016 protected
-rw-r--r-- 1 root root 230532130 Jul 5 11:38 sz51lion.tar.tgz
tomcat
[[email protected] vhost]# cat 51lion.conf.http
server {
listen 80;
client_max_body_size 5m;
server_name www.51lion.com 51lion.com;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log on;
access_log /tmp/51lionaccess.log combined;
error_log /tmp/51lionerror.log;
location / {
proxy_pass http://10.117.73.97:80;
}
location /Login {
proxy_pass http://10.117.73.97:8080/Login;
}
location /LionFinancing {
proxy_pass http://10.117.73.97:8080/LionFinancing;
}
location /LionStatistic{
proxy_pass http://10.117.73.97:8080/LionStatistic;
}
}
发布与目录
[[email protected] ~]# ll /usr/local/tomcat-7.0.68/webapps/
total 28064
drwxr-xr-x 4 root root 4096 Nov 15 20:08 LionApp
-rw-r--r-- 1 root root 28697338 Nov 7 09:36 LionApp.war
drwxr-xr-x 5 root root 4096 Jul 28 17:17 LionFinancing
drwxr-xr-x 5 root root 4096 Mar 25 2016 LionStatistic
drwxr-xr-x 10 root root 4096 Nov 17 14:14 Login
drwxr-xr-x 5 root root 4096 Apr 15 2016 manager
-rw-r--r-- 1 root root 186 Oct 27 14:31 qqconnect.log
drwxr-xr-x 3 root root 4096 Apr 15 2016 ROOT
drwxr-xr-x 14 root root 4096 Oct 19 11:15 TradeWebAPI
drwxr-xr-x 8 root root 4096 Oct 27 15:39 UserServer
发布脚本
#!/bin/bash
#by Automatic synchronization SVN code
#From csy to 2016-04-26
#This is GYS PHP 51LION project
svn up
##############定义变量####################
SVN_DATE=`date +%Y%m%d`
TAR_DATE=$(date +%Y%m%d-%H%M).tar.gz
SVN_DIR=/root/svndir/Deploy/51lion/$SVN_DATE/ #svn代码目录
PHP_DIR=/var/www/html/ #网站目录
ITB_DIR=/root/itemback/51lion #备份目录
CODE_NAME=`ls -lt $SVN_DIR |awk ‘NR==2 {print $9}‘` #代码包
NAMEZIP=${CODE_NAME:0-3} #确保最新的发布文件
##############正式运行自动备份、打包、更新脚本##############
if [[ -z $CODE_NAME ]];then
exit 1
echo "Did not get to the code package, may not exist!"
else
if [[ "$NAMEZIP" = "zip" ]];then
cd $PHP_DIR
tar --exclude=51lion/resource --exclude=51lion/static --exclude=51lion/uploads -czvf $ITB_DIR/51lion-$TAR_DATE 51lion/* #打包所有旧代码
unzip -o $SVN_DIR/$CODE_NAME -d $PHP_DIR #发布所有代码
echo "Packaging, backup and update is complete, please restart your service!!!!!!!!!"
if [ $? -eq 0 ];then
echo -e "\033[37mRestart successfully, please visit the page view!!!\033[1m"
else
echo -e "\033[37mRestart error, please check !!!\033[0m"
fi
else
exit 1
fi
fi
find $ITB_DIR/ -mtime +15 |xargs rm -rf {} \;
if [ $? -eq 0 ];then
echo -e "\033[37m删除15天以前的备份项目完成...\033[1m"
else
echo -e "\033[37m命令执行出错或找不到目录,请检查\033[0m"
fi
备份脚本
#!/bin/bash
#auto backup mysql shell
#by csy 2015-11-11
#自动备份数据库、并添加任务计划脚本
#定义变量===============
BAK_DIR=/mnt/mysqlbak/
BAK_DATE=`date +%Y-%m-%d-%H%M`
#环境测试..........
if [ $UID -ne 0 ];then
echo -e "\033[32m必须使用ROOT用户才能执行此脚本.\033[0m"
exit
fi
#if [ ! -d $BAK_DIR ];then
#mkdir -p $BAK_DIR
#echo -e "\033[35m $BAK_DIR 这个目录创建成功!!!\033[1m"
#else
#echo -e "\033[35m$BAK_DIR 这个目录已经存在...\033[0m"
#fi
#正式备份.....
#$BAK_CMD -u$BAK_USER -p$BAK_PASS -h$BAK_HOST -P$BAK_PORT -d --routines --default-character-set=utf8 --databases $BAK_DB > $BAK_DIR/$BAK_DB-$BAK_DATE.sql
mysqldump -ulb -p51lion_com -h10.141.19.82 -P3306 --routines --default-character-set=utf8 --databases lb51 > $BAK_DIR/lb51-$BAK_DATE.sql
if [ $? -eq 0 ];then
echo -e "\033[34m数据库备份已经完成....\033[1m"
echo "备份目录:$BAK_DIR"
else
echo -e "\033[34m数据备份出错,请检查....\033[0m"
fi
find $BAK_DIR/ -mtime +30 |xargs rm -rf {} \;
if [ $? -eq 0 ];then
echo -e "\033[37m删除30天以前的备份数据完成...\033[1m"
else
echo -e "\033[37m命令执行出错或找不到目录,请检查\033[0m"
svn
https://my.oschina.net/jean/blog/340680
http://www.centoscn.com/CentosServer/ftp/2013/1217/2244.html
192.168.1.245
root 23365 1 0 Nov29 ? 00:00:02 svnserve -d -r /svn/lion
svnserve -d -r /svn/lion 启动
pkill -9 23365 停着
[[email protected] conf]# ls -a
. .. .authz .passwd svnserve.conf
[[email protected] conf]# pwd
/svn/lion/conf
本文出自 “秋水无痕” 博客,谢绝转载!
以上是关于狮子金融的主要内容,如果未能解决你的问题,请参考以下文章