#本文是做记录使用,不做为任何参考文档#

迁移代码

将源代码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的更多相关文章

  1. 搭建备份到业务迁移---mysql

    mysql安装启动以及配置 使用到阿里云主机直接yum安装以及配置 [root@yunwei-169 mysql]# yum install mysql mysql-server [root@yunw ...

  2. 华为云计算IE面试笔记-华为云计算解决方案业务迁移支持哪些迁移?有哪些特点?请描述基本的业务交付流程、业务迁移流程和原则。

    1. 迁移场景:华为云计算解决方案按照源端环境来说,支持P2V.V2V(P2V:物理设备(操作系统及其上的应用软件和数据)迁移到华为虚拟化平台.V2V:其他厂商的虚拟化平台迁移到华为虚拟化平台.)以及 ...

  3. 减少存储过程封装业务逻辑-web开发与传统软件开发的思维模式不同

    本篇文章讨论并不是:不要使用存储过程,因为有些事情还是要存储过程来完成,不可能不用.而是关于:"业务逻辑是不是要封装在存储过程中实现,这样子php.java等就是调用存储过程". ...

  4. 迁移web.py项目至git@osc的项目演示平台

    1. 开启演示平台 选择WSGI,输入应用名称,即是演示网页的网址. 2. web.py代码迁移 将Python的site-packages目录下的web文件夹复制到代码目录下,与网页程序在同一个文件 ...

  5. 业务迁移---redis

    以前也没怎么搞过redis 只知道他是一个nosql数据库很强大,这次迁移用到了~  正好熟练一下并记录过程,还挺繁琐.. 记录一下在学习中的几个问题,总结加深一下印象,有可能会漏掉或者有误差的地方~ ...

  6. 【Web应用-迁移】迁移 Web 应用到新的应用服务计划的相关限制和说明

    现象描述 当前 Web 应用所在的应用服务计划和目标应用服务计划属于同一个资源组,但是通过 Portal 点击 “更改应用服务计划”,依旧看不到目标应用服务计划. 问题分析 导致上述问题的原因是,用户 ...

  7. Web API项目中使用Area对业务进行分类管理

    在之前开发的很多Web API项目中,为了方便以及快速开发,往往把整个Web API的控制器放在基目录的Controllers目录中,但随着业务越来越复杂,这样Controllers目录中的文件就增加 ...

  8. svn服务器 备份,迁移,部署方案

    这次做业务迁移,要从一个云厂商迁移到某云厂商,之前每天到全备svn排到用场了,需要搭建一个全新到svn服务并要做迁移,并实现我们开发机到时时代码同步 一.svn备份有很多种,优劣都不同,百度可查,我采 ...

  9. 解决项目迁移至Kubernetes集群中的代理问题

    解决项目迁移至Kubernetes集群中的代理问题 随着Kubernetes技术的日益成熟,越来越多的企业选择用Kubernetes集群来管理项目.新项目还好,可以选择合适的集群规模从零开始构建项目: ...

随机推荐

  1. Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cannot resolve reference to bean 'factory' while setting bean property 'sqlSessionFactory'; nested excep

    Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cann ...

  2. Pycharm常用的快捷键

    常用快捷键: Ctrl + D              复制选定的区域或行 Ctrl + Y               删除选定的行 Ctrl + Alt + L         代码格式化 Ct ...

  3. centos配置NTP服务器

    时间服务器: NTP(Network Time Protocol,网络时间协议)是用来使用网络中的各个计算机时间同步的一种协议,NTP服务器就是利用NTP协议提供时间同步服务的. 一.环境准备: 1. ...

  4. PWA-网络

    PWA-网络 fetch API Get fetch('/some/url',{ method:'GET' }).then(function(resp){ //success }).catch(fun ...

  5. ggnetwork

    ggnetwork ggnetwork PeRl 简介 ggnetwork是根据ggplot2的语法,开发的用于网络图可视化的包.虽然igraph是优秀的network处理包,但是在可视化方面依然是弱 ...

  6. MapWindow介绍

    官方网站:http://www.mapwindow.org/ 网站里包含了几个开源项目 目前最新版本是Mapwindow5,之前的mapwindow4版本已经停止更新,同时Mapwindow5底层是调 ...

  7. 北京Uber优步司机奖励政策(1月2日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  8. #386. 【UNR #3】鸽子固定器

    #386. [UNR #3]鸽子固定器 题目链接 官方题解 分析: 神奇的做法+链表. 首先按照大小排序. 对于小于选择小于m个物品的时候,这个m个物品一定是一段连续的区间.因为,如果中间空着一个物品 ...

  9. springBoot 自定义redisTemplate

    package com.atirm.mybatismutiplesource.config.RedisConfig; import com.atirm.mybatismutiplesource.ent ...

  10. 「日常训练」Watering Flowers(Codeforces Round #340 Div.2 C)

    题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_ ...