zoukankan      html  css  js  c++  java
  • 记一次网站服务器迁移(my)

    遇到的难题:

    基本没有遇到太大的问题,因为服务器环境是配好的阿里云环境,最后再nginx的rewrite配置遇到了一点问题,最后也算解决。

    收获小点:

    1)

    vim替换命令:

    利用 :s 命令可以实现字符串的替换。具体的用法包括:
      :s/str1/str2/ 用字符串 str2 替换行中首次出现的字符串 str1
      :s/str1/str2/g 用字符串 str2 替换行中所有出现的字符串 str1
      :.,$ s/str1/str2/g 用字符串 str2 替换正文当前行到末尾所有出现的字符串 str1
      :1,$ s/str1/str2/g 用字符串 str2 替换正文中所有出现的字符串 str1
      :g/str1/s//str2/g 功能同上
      从上述替换命令可以看到:g 放在命令末尾,表示对搜索字符串的每次出现进行替换;不加 g,表示只对搜索
      字符串的首次出现进行替换;g 放在命令开头,表示对正文中所有包含搜索字符串的行进行替换操作。

    例子:

    替换‘;’为 空格+last+';'

    :1,$ s/;/s last;/s

    其他: :回车    s:空格

    2)nginx伪静态配置

    伪静态代码:

    rewrite ^/discover$ /index.php?do=discover;

    rewrite ^/content/([0-9]+)$ /index.php?do=content&workid=$1;

    rewrite ^/discover/([0-9]+)$ /index.php?do=discover&id=$1;

    rewrite ^/content/([0-9]+)[-]([0-9]+)$ /index.php?do=content&workid=$1&contentId=$2;

    rewrite ^/home/([0-9]+)$ /index.php?do=home&id=$1;

    rewrite ^/works/([0-9]+)$ /index.php?do=home&act=works&id=$1;

    rewrite ^/myworks$ /index.php?do=works;

    rewrite ^/myworks/([0-9]+)$ /index.php?do=works&pNO=$1;

    rewrite ^/account$ /index.php?do=account;

    rewrite ^/avatar$ /index.php?do=account&act=avatar;

    rewrite ^/password$ /index.php?do=account&act=password;

    rewrite ^/signin$ /index.php?do=signin;

    rewrite ^/signup$ /index.php?do=signup;

    rewrite ^/resetpass$ /index.php?do=resetpass;

    rewrite ^/getemail$ /index.php?do=resetpass&act=getemail;

    rewrite ^/newpass$ /index.php?do=resetpass&act=newpass;

    rewrite ^/discover/([0-9]+)[-]([0-9]+)$ /index.php?do=discover&id=$1&pNO=$2;

    rewrite ^/works/([0-9]+)[-]([0-9]+)$ /index.php?do=home&act=works&id=$1&pNO=$2;

    rewrite ^/create/([0-9]+)$ /index.php?do=create&workId=$1;

    rewrite ^/create/([0-9]+)[-]([0-9]+)$ /index.php?do=create&workId=$1&contentId=$2;

    rewrite ^/newcreate/([0-9]+)$ /index.php?do=create&act=creatework&workId=$1;

    rewrite ^/creatework/([0-9]+)[-]([0-9]+)$ /index.php?do=create&act=creatework&workId=$1&contentId=$2;

  • 相关阅读:
    如何勾选 servlet如何获取?
    过滤器 如何实现获取不到用户名跳转回登录界面
    验证码
    cookie保存用户名及密码
    游标
    存储过程和自定义函数的区别
    瞎搞
    sql 试图索引
    sql 常用函数
    sql 简单的定义变量 声明 输出
  • 原文地址:https://www.cnblogs.com/zsmynl/p/4726020.html
Copyright © 2011-2022 走看看