当前位置: 首页 > news >正文

有效的网站需要做到什么意思商业网站是什么

有效的网站需要做到什么意思,商业网站是什么,苏州相城网站建设,英文网站设计哪家好欢迎大家到我的博客浏览。hexo博客部署到云服务器 | YinKais Blog 这篇文章带大家将hexo博客部署到云服务器上#xff01; 一、服务器环境安装 1、安装 node js yum install gcc-c make yum -y install nodejs yum -y install npm 验证 node -v npm -v 2、安装git、ngin…   欢迎大家到我的博客浏览。hexo博客部署到云服务器 | YinKais Blog 这篇文章带大家将hexo博客部署到云服务器上 一、服务器环境安装 1、安装 node js yum install gcc-c make yum -y install nodejs yum -y install npm 验证 node -v npm -v 2、安装git、nginx yum install git nginx -y 3、安装 hexo npm install hexo-cli hexo-server -g 验证 hexo 二、创建服务器git环境 1、创建 git 用户 adduser git passwd git 2、创建证书 切换到git用户su git 创建.ssh目录mkdir ~/.ssh chmod 700 ~/.ssh 然后在云服务创建authorized_keys公钥保存文件 touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys 将本地的公钥粘贴到 authorized_keys 文件中 cat ~/.ssh/id_rsa.pub 如果本地没有公钥或者后续上传失败可以使用下面的命令重新生成一个公钥。 ssh-keygen -t rsa -b 2048 -C your_emailexample.com __ tip: __ 公钥保存文件authorized_keys是一行添加一个 3、创建 git 仓库目录 回到服务器目录创建名为 blog 的 git 仓库目录。 su - mkdir /var/repo cd /var/repo git init --bare blog.git 4、配置 git hooks vim /var/repo/blog.git/hooks/post-receive 添加内容 #!/bin/sh git --work-tree/var/www/hexo --git-dir/var/repo/blog.git checkout -f 保存退出并设置权限 chmod x /var/repo/blog.git/hooks/post-receive 5、改变 BLOG.GIT 目录的拥有者为 GIT 用户 chown -R git:git blog.git 6、创建静态文件目录并将第 3 步骤生成的git仓库链接到静态文件目录下 创建静态文件目录文章网页mkdir /var/www、mkdir /var/www/hexo 链接git仓库chown -R git:git /var/www/hexo 配置权限chmod -R 755 /var/www/hexo 这样git仓库更新便会自动同步到hexo目录下 7、为了安全考虑禁用GIT用户的SHELL 登录权限配置下面两个步骤非常重要否则客户端总是提示密码错误 首先你必须确保 git-shell 已存在于 /etc/shells 文件中 使用命令 which git-shell 判断系统是否安装了 git-shell。如果已经安装则返回 git-shell 的安装目录如/usr/bin/git-shell如果未安装则需要安装git-shell命令安装命令yum install git 判断shells文件是否存在判断命令cat /etc/shells 如果文件不存在或没有 /usr/bin/git-shell 则需要使用vim增加这个路径 sudo vim /etc/shells 在最后一行添加 git-shell路径 /bin/sh /bin/bash /usr/bin/sh /usr/bin/bash /usr/bin/git-shell # 添加你的git-shell 在终端中输入 sudo chsh git然后在New shell [/bin/bash]: 后输入git-shell路径/usr/bin/git-shell 修改完成后验证 vim /etc/passwd找到类似git:x:1000:1000:,,,:/home/git:/usr/bin/git-shell看看git用户是否是以git-shell结尾 这样git用户就只能使用SSH连接对Git仓库进行推送和拉取操作而不能登录机器并取得普通shell命令 三、配置本地创建 本地安装 hexo 的过程这里省略了大家可以参考 GitHub Pages Hexo搭建个人博客网站史上最全教程 。 在 hexo 根目录用 管理员身份 打开 cmd执行 npm install hexo-deployer-git --save 打开本地 hexo 博客目录编辑_config.yml文件 修改repository为 deploy:type: gitrepository: gitip或域名:/var/repo/blog.gitbranch: master 然后执行下面的命令将文件上传到你部署的服务器上如果上传成功则本地配置创建完成。 hexo clean # 清缓存 可选 hexo g hexo d 四、nginx 配置 1、修改 nginx 的 DEFAULT 设置 为了能让浏览器能直接访问静态页面需要使用nginx将端口或域名指向hexo静态文件目录。 ubuntu vim /etc/nginx/sites-available/default centos vim /etc/nginx/conf.d/default.conf 注意不同版本的nginx或系统nginx的配置文件不一定相同根据具体情况来修改配置。 2、将其中的 ROOT 指令指向 /var/www/hexo 目录也就是GIT钩子目录 3、 最后重启服务让NGINX生效 service nginx restart 4、然后在浏览器中输入网址即可看到网站。 五、补充命令 补充点有用的命令 1、生成一篇文章 在hexo-blog目录下用git-bash hexo new post 我的文章 2、上传新文章 hexo g -d 3、后台admin/界面编辑文章 在hexo根路径下用bash下载 npm install --save hexo-admin 只能在localhost:4000编辑 输入localhost:4000/admin进入界面 可以在编辑文章的同时实时预览效果 六、配置服务器域名与https证书 1、服务器绑定域名 直接到购买域名的服务商对域名进行解析并添加记录值服务器ip地址等待一段时间后便可访问了。但这个时候网站显示不安全即非 https需要进行域名备案然后绑定证书。 域名备案周期会比较长大概需要 20 天大家可以根据自己的用途考虑是否需要备案。 2、https 证书绑定 首先需要获取一个证书详情可以参考  Nginx配置SSL证书。 获取到证书后将证书所带的两个文件我的是 .pem 和 .key 文件上传到服务器的某个文件夹里存放好。 然后打开服务器 nginx 配置文件我的是 /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/doc/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 4096; ​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; ​server {listen       80;listen       [::]:80;server_name yinkai.cc; # 一修改域名root       /var/www/hexo; # 二修改为你的项目根目录rewrite ^(.*)$ https://$host$1; # 三重定向到https# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf; ​error_page 404 /404.html;location /404.html {} ​error_page 500 502 503 504 /50x.html;location /50x.html {}} ​ # Settings for a TLS enabled server. ​server {listen       443 ssl http2;listen       [::]:443 ssl http2;server_name yinkai.cc; # 四修改为你的域名root         /var/www/hexo; # 五修改为你的项目根目录 ​ssl_certificate /etc/nginx/SSL/yinkai.cc.pem; # 六修改到你的 .pem 文件路径ssl_certificate_key /etc/nginx/SSL/yinkai.cc.key; # 七修改到你的 .key 文件路径ssl_session_cache shared:SSL:1m;ssl_session_timeout 10m;ssl_ciphers HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers on; ​# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf; ​error_page 404 /404.html;location /40x.html {} ​error_page 500 502 503 504 /50x.html;location /50x.html {}location / {try_files $uri $uri/ /index.html;}} ​ } 上面标注的地方就是需要修改的配置文件的内容。 修改完成后使用下面的命令重启 nginx 即可 systemctl restart nginx 3、api 访问域名绑定 我这里因为使用了 valine 评论插件所以需要将域名绑定到 leancloud 上。 4、LeanCloud 安全中心增加 Web 安全域名 若有多个可以填写多个统计的数据是不一样的每一行一个域名用换行进行分割。
http://www.zqtcl.cn/news/156048/

相关文章:

  • 网站设计开发网站用c 建网站时怎么做导航菜单栏
  • 哪些网站做推广比较有效果厦门网站建设公司名单
  • 街头小吃加盟网站建设网站专题制作
  • 网站论坛推广方案加强思政部网站建设
  • 查看WordPress网站插件北京西站附近的景点有哪些
  • 网站建设技术合同模板下载怎么用phpstudy做网站
  • 青岛网站建设找二维码生成器怎么弄
  • 百度突然搜不到我的网站网络安全软件有哪些
  • 江阴做网站的地方网站维护需要的知识
  • 做网站是域名怎么申请网页设计跟做网站一样吗
  • 叮当快药网站谁做的网站开发遇到的最大困难
  • 一个域名可以建几个网站毕业设计可以做哪些简单网站
  • 知名商城网站建设报价wordpress 后台 logo
  • 单位网站建设框架yellow网站推广联盟
  • html5和php做网站做网站租用服务器
  • 网站开发中效率较高的编程语言公司域名注册流程
  • 万户网站管理系统4.0cms监控系统手机版下载
  • 宁波专业网站建设怎么做如何做一个虚拟网站
  • 网站栏目建设调研公司怎么建立一个网站
  • 苍溪建设局网站网站建设和维护采购协议
  • 代做网站微信号下载 wordpress插件
  • 泉州住房建设局网站wordpress输入html代码
  • 为什么访问外国网站速度慢沈阳网站公司排名
  • 网站建设+泰安网站项目建设策划方案
  • 微信人生里面微网站怎么做wordpress 第三方登录 代码
  • 做商城网站哪里高端大气网站案例
  • 网站做项目网站设计公司深
  • 学校做网站及费用建设网站有何要求
  • 河北邢台移动网站建设宁波网站开发公司电话
  • 免费建立个人网站申请seo搜索引擎优化推广