### 安全规则设置端口
> 云服务控制中,选择“安全规则”设置入网规则,设置端口为子域名的端口,别使用平常使用的端口,如图:
### 先启动服务
> 先将二级域名服务器开启,端口设置为安全规则一致即可,比如开启的 3000端口,可以通过域名直接访问到,http://xxx.com:3000
### 配置nginx
> 在 nginx 安装目录下的conf目录下的 nginx.conf 。进行打开
```
cd nginx/conf
```
> 进行编辑
```
vi nginx.conf
```
#### 使用情况一:
> 将当前nginx网站替换成其他的网站,内容如下:
```
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
# .....省略
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
# ----------------修改此出----------
#root html;
# index index.html index.htm;
proxy_pass http://localhost:3000; # 添加上
}
# 省略
}
```
#### 第二种情况
> 只是弄二级域名。新增的内容如下(注意:新增的必须在第一个server后面新增,不然就是跑第一个当主网站了):
```
#user nobody;
worker_processes 1;
# .. 省略代码
http {
include mime.types;
default_type application/octet-stream;
#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;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
# proxy_pass http://localhost:3000;
}
# .. 省略代码
}
# ------------------ 找到上面server结束的 } 括号,在下面进行新增 -------
server {
listen 80; # 端口
server_name api.xxx.cn; # 域名
location / {
proxy_pass http://localhost:3000; # 代理的地方
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
# .. 省略代码
}
```
### 重新启动 nginx
> 记住是重启,不是启动
```
/usr/local/nginx/sbin/nginx -s reload
```
### 就可以访问了
### 源代码
> 有些注释去掉了后,一看就明白了,只要在server 后面新增一个就可以了,然后再改改参数
```
#user nobody;
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;
#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;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
rewrite ^(.*)$ https://$host$1 permanent; #用于将http页面重定向到https页面
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# 只能在第一个 server 后面新增,不能放在前面
server {
listen 80; # 端口
server_name api.xxx.cn; # 域名
rewrite ^(.*)$ https://$host$1 permanent; #用于将http页面重定向到https页面
location / {
proxy_pass http://localhost:3000; # 代理的地方
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
```
- LOLKU
- 工具类
- form/formData
- form
- formData
- iframe
- 渲染数据,防止内存泄漏
- 获取url(路由)参数
- 常用方法
- 失去焦点软键盘页面乱
- 判断数据类型
- 浏览器全屏
- 动态插入css
- 随机生成自定义长度位数数字
- 验证判断
- localStorage 封装存储
- 格式化日期
- 计算两个时间差
- 去除空格
- 将驼峰命名转换为连字符
- 获取dom属性
- 深拷贝
- class操作
- 判断是否打开浏览器控制台
- 全国城市地区代码表
- canvas合成工具
- 去除emoji表情符号
- 比较两个对象属性和内容(值)一致
- 微信结束页面事件
- 正则匹配url替换域名
- 字符串拼接(渲染dom后传值)
- 判断是否是正则
- 日历算法
- json 工具
- 是否支持webp格式
- h5底部输入框被键盘遮挡问题
- php
- php 二级域名管理
- 单个或者多个域名跨域
- file_get_contents 正确使用
- fromData请求无法携带cookie
- 简单的加密文件传输
- css
- 1px
- 滚动
- ios点击有颜色
- 文本溢出省略号
- css动画抖动
- 文本换行与不换行
- 阻止旋转屏幕时自动调整字体大小
- vue
- vscode 调试
- 新技术
- vue-router 4.0
- vue3
- 基础
- 试验
- javascript
- 上传问题
- 文件选中过,第二次再次选中不触发change事件
- 上传oss
- 后台
- linux搭建服务
- 需安装
- nginx
- 安装
- nginx http 配置二级域名
- nginx https 配置二级域名
- 防止暴力破解
- 阿里申请免费https
- git
- 快速安装
- 配置项
- node
- 安装
- pm2
- mysql
- 安装
- 创建、切换、查询数据库
- 常用命令
- cmake 编译器
- redis
- 软件下载
- git
- 百度git 记住密码
- 经验
- 上传
- 软件
- vscode
- 推荐插件
- 应用开发
- nwjs
- 入门
- package.json
- vue、react、angular 跑nwjs
- 打包
- 监听屏幕
- 运行另一个.exe文件
- node应用
- electron
- 资料
- 安装
- 实战
- 崩溃日志报告
- electron-forge
- 托盘闪烁
- 开机自动启动
- 消息通知
- 禁止默认事件
- 保证只有一个实例
- 打包且美化安装界面
- 创建cli
- 添加Github徽章
- 自动更新
- docsify
- Lowdb存储数据
- 备份、恢复、导入、导出
- 深度链接(协议)唤起Electron应用
- 说明
- 加载扩展插件
- 证书
- Sketch 插件
- 工作
- 宣传文章地址
- api
- tinypng
- npm 插件
- fs封装:fs-jetpack
- 判断是否npm或yarn运行
- 字符串或缓冲区的gzip压缩大小
- 克隆并修改RegExp实例
- 反转对象的键/值
- http路由find-my-way
- dragula 拖拽(拖放)
- svga
- npm 脚手架搭建
- 项目
- 小工具
- svg转图片
- 日历