业务迁移---web
#本文是做记录使用,不做为任何参考文档#
迁移代码
将源代码scp至新的server上
搭建服务
yum安装nginx服务
yum install nginx #yum安装
service nginx start #启动服务
配置文件相关
备份原文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
因为我是同时迁移两个不通域名的web后台,所以涉及到了nginx的虚拟目录
为了主配置文件清晰点,所以使用了 include /etc/nginx/conf.d/*.conf; 将不通的server配置拆分出去~
include 要写在http字段内(#废话#)
vi /etc/nginx/nginx.conf # For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf; events {
worker_connections 1024;
} http {
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 /var/log/nginx/access.log main; sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048; include /etc/nginx/mime.types;
default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf; # Settings for a TLS enabled server.
"/etc/nginx/nginx.conf" 69L, 1979C
虚拟目录配置
到/etc/nginx/conf.d/ 下创建以.conf结尾的文件会被nginx解析 aaa.com.conf bbb.com.conf
[root@]# cd /etc/nginx/conf.d/
[root@]# ll
total 12
-rw-r--r-- 1 root root 516 Jul 24 13:54 aaa.com.conf
-rw-r--r-- 1 root root 556 Jul 28 16:59 bbb.conf
[root@]#
[root@iz8vbilqy0q9v8tds55bqzz conf.d]# cat aaa.com.conf
server {
listen 80;
server_name aaa.com;
root /var/www/aaa.com;
index index.html index.htm index.php;
location /APP/{ #例如nginx的重定向功能,将访问/APP/开头指定到interface文件中
index index.php;
if (!-e $request_filename){
rewrite ^/APP/(.*)$ /interface.php?s=$1 last;
break;
}
} location ~ \.php$ { #指定本地php解析,fastcgi 信息
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /var/www/aaa.com$fastcgi_script_name;
include fastcgi_params;
}
}
[root@]#
[root@iz8vbilqy0q9v8tds55bqzz conf.d]# cat bbb.com.conf
server {
listen 80;
server_name bbb.com;
root /var/www/bbb.com;
index index.html index.htm index.php;
location /APP/{ #例如nginx的重定向功能,将访问/APP/开头指定到interface文件中
index index.php;
if (!-e $request_filename){
rewrite ^/APP/(.*)$ /interface.php?s=$1 last;
break;
}
} location ~ \.php$ { #指定本地php解析,fastcgi 信息
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /var/www/bbb.com$fastcgi_script_name;
include fastcgi_params;
}
}
[root@]#
按以上配置完成后,即可访问相应的目录~
www.aaa.com
www.bbb.com
##########################################################
有个小插曲记录一下,我搭建好服务后发现bbb.com的php文件没有解析,aaa却正常,报错~
原来两个服务的框架不一样,bbb的框架写的不太规范,导致了解析失败,更改php.ini文件解决
short_open_tag = Off 默认为OFF更改为 short_open_tag = ON
官方的解释,是要打开适配 <? ?> 这种不规则的写法。~~~~
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = ON
#######################
还有类似的权限啊,chown -R nginx.nginx /var/www/xxxx 等等细节需要注意,有可能会影响~
#######################
如果有redis服务的话,也会影响使用,例如缺少了redis的插件,redis服务没有集体迁移
我就遇到了redis服务迁移出的问题,redis内容太大了我内存比较低导致了服务总被系统kill掉,通过dmesg日志才发现的。。。
#######################
迁移的时候问题很多,查看nginx和php的错误日志可以很快定位问题
业务迁移---web的更多相关文章
- 搭建备份到业务迁移---mysql
mysql安装启动以及配置 使用到阿里云主机直接yum安装以及配置 [root@yunwei-169 mysql]# yum install mysql mysql-server [root@yunw ...
- 华为云计算IE面试笔记-华为云计算解决方案业务迁移支持哪些迁移?有哪些特点?请描述基本的业务交付流程、业务迁移流程和原则。
1. 迁移场景:华为云计算解决方案按照源端环境来说,支持P2V.V2V(P2V:物理设备(操作系统及其上的应用软件和数据)迁移到华为虚拟化平台.V2V:其他厂商的虚拟化平台迁移到华为虚拟化平台.)以及 ...
- 减少存储过程封装业务逻辑-web开发与传统软件开发的思维模式不同
本篇文章讨论并不是:不要使用存储过程,因为有些事情还是要存储过程来完成,不可能不用.而是关于:"业务逻辑是不是要封装在存储过程中实现,这样子php.java等就是调用存储过程". ...
- 迁移web.py项目至git@osc的项目演示平台
1. 开启演示平台 选择WSGI,输入应用名称,即是演示网页的网址. 2. web.py代码迁移 将Python的site-packages目录下的web文件夹复制到代码目录下,与网页程序在同一个文件 ...
- 业务迁移---redis
以前也没怎么搞过redis 只知道他是一个nosql数据库很强大,这次迁移用到了~ 正好熟练一下并记录过程,还挺繁琐.. 记录一下在学习中的几个问题,总结加深一下印象,有可能会漏掉或者有误差的地方~ ...
- 【Web应用-迁移】迁移 Web 应用到新的应用服务计划的相关限制和说明
现象描述 当前 Web 应用所在的应用服务计划和目标应用服务计划属于同一个资源组,但是通过 Portal 点击 “更改应用服务计划”,依旧看不到目标应用服务计划. 问题分析 导致上述问题的原因是,用户 ...
- Web API项目中使用Area对业务进行分类管理
在之前开发的很多Web API项目中,为了方便以及快速开发,往往把整个Web API的控制器放在基目录的Controllers目录中,但随着业务越来越复杂,这样Controllers目录中的文件就增加 ...
- svn服务器 备份,迁移,部署方案
这次做业务迁移,要从一个云厂商迁移到某云厂商,之前每天到全备svn排到用场了,需要搭建一个全新到svn服务并要做迁移,并实现我们开发机到时时代码同步 一.svn备份有很多种,优劣都不同,百度可查,我采 ...
- 解决项目迁移至Kubernetes集群中的代理问题
解决项目迁移至Kubernetes集群中的代理问题 随着Kubernetes技术的日益成熟,越来越多的企业选择用Kubernetes集群来管理项目.新项目还好,可以选择合适的集群规模从零开始构建项目: ...
随机推荐
- linux配置mysq与navicat关联
第一步:在linux中安装mysql(执行如下语句) 安装 mysql: yum install mysql yum install mysql-server yum install mysql-de ...
- Ubuntu18.04安装完应该做的一些事 显卡驱动安装和cuda8.0
博主装Ubuntu18.04主要是为了用于跑深度学习,所以我们先来搞搞gcc环境 第一步:安装多版本gcc.g++可切换 sudo apt-get install gcc-4.8 gcc-4.8-mu ...
- Tornado异步与延迟任务
最近一直在研究Tornado异步操作,然而一番研究后发现要使一个函数异步化的最好方法就是采用相关异步库,但目前很多功能强大的库都不在此列.经过一番查找文档和搜索示范,终于发现了ThreadPoolEx ...
- PHP中计算字符串相似度的函数代码
similar_text — 计算两个字符串的相似度 int similar_text ( string $first , string $second [, float &$percent ...
- hadoop学习笔记——zookeeper平台搭建
zookeeper是一个自动管理分布式集群的一个工具,以实现集群的高可用. 比如集群中的一个机器挂掉了,没有zookeeper的话就得考虑挂一个机器对剩下集群工作的影响,而有了zookeeper,它就 ...
- Hive--关联表(join)
在hive中,关联有4种方式: 内关联:join on 左外关联:left join on 右外关联:right join on 全外关联:full join on 另外还有一种可实现hive笛卡儿积 ...
- Linux3.5—视屏模块学习与分析
插入USB摄像头后,我看到了识别出的一些信息,在内核源码中搜到了相关信息: 搜索之后,在uvc_driver.c 帮助文档:linux-3.5/Documentation/video4linux/v4 ...
- UDP server Code
Code Example: The following programs demonstrate the use of getaddrinfo(), gai_strerror(), freeaddri ...
- JS本地保存数据的几种方法
1.Cookie 这个恐怕是最常见也是用得最多的技术了,也是比较古老的技术了.COOKIE优点很多,使用起来很方便 但它的缺点也很多: 比如跨域访问问题:无法保存太大的数据(最大仅为4KB):本地保存 ...
- C++中引用的本质分析
引用的意义 引用作为变量别名而存在,因此在一些场合可以代替指针 引用相对于指针来说具有更好的可读性和实用性 swap函数的实现对比: void swap(int* a, int* b) { int t ...