业务迁移---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集群来管理项目.新项目还好,可以选择合适的集群规模从零开始构建项目: ...
随机推荐
- Grub4dos boot
Grub4dos 0.4.6a http://grub4dos.chenall.net/ Ghost11.5 bcdedit bcdedit /create /d "Grub4dos&quo ...
- What is a schema in a MySQL database?
摘自:https://www.quora.com/What-is-a-schema-in-a-MySQL-database What is schema? In MySQL, physically, ...
- linux系统基础之六--系统引导(基于centos7.4 1708)
- PredicateBuilder
using System; using System.Linq; using System.Linq.Expressions; namespace Oyang.Tool { public static ...
- Linux常用97条命令
1.ls [选项] [目录名 | 列出相关目录下的所有目录和文件 -a 列出包括.a开头的隐藏文件的所有文件 -A 通-a,但不列出"."和".." -l ...
- Python学习5——基本格式化输出
整数的格式化输出 十进制.八进制.十六进制 num01 = 100 print("十进制输出:%d"%num01) print("八进制输出:%o"%num01 ...
- C指针(3)——指向指针的指针(程序讲解)
int **q可以分成两部分,即int* 和 (*q),后面的 “q” 中的* 表示q是一个指针变量,前面的int*表示指针变量q只能存放int*型变量的地址.int** q表示为指针变量q只能存放i ...
- MVC PartialView 方式实现点击加载更多
<table id="MovieListing"> </table><div> <button id="btnShowMore& ...
- url和uri的一些问题
一 url和uri的区别: uri: uniform resource identifier,统一资源标识符. url: uniform resource locator,统一资源定位符. 做一个类比 ...
- H5-基础-day01
类选择器和ID选择器 相同点:可以应用于任何元素不同点: 1.ID选择器只能在文档中使用一次.与类选择器不同,在一个HTML文档中,ID选择器只能使用一次,而且仅一次.而类选择器可以使用多次. 2 ...