折腾:
后,需要把编译好的gitbook上传到自己的crifan.com上。
最好的放置位置是弄个二级域名
或
把book相关的内容都放进去
而自己之前的网站是lnmp搭建的。
所以去:
lnmp 二级域名
所以先去:
lnmp 添加二级域名
去用lnmp去添加二级域名
参考:
LNMP添加、删除虚拟主机及伪静态使用教程 – LNMP一键安装包
添加之前,先去自己搞清楚当前的路径设置
去centos中用命令行创建二级域名对应目录
<code>[root@crifan lnmp]# pwd /home/wwwroot/crifan/lnmp [root@crifan wwwroot]# ll total 8 drwxr-xr-x 3 www www 4096 Sep 10 12:16 crifan drwxr-xr-x 13 www www 4096 Dec 4 22:48 www.crifan.com [root@crifan wwwroot]# mkdir book.crifan.com </code>
后发现创建者是root
为了防止权限问题,所以还是删除掉,用lnmp的vhost自己创建吧。
算了,不用伪静态了 -》 此处后续都支持放html,css,js的静态页面。
<code>[root@crifan wwwroot]# lnmp vhost add +-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | https://lnmp.org | +-------------------------------------------+ Please enter domain(example: www.lnmp.org): book.crifan.com Your domain: book.crifan.com Enter more domain name(example: lnmp.org *.lnmp.org): Please enter the directory for the domain: book.crifan.com Default directory: /home/wwwroot/book.crifan.com: /home/wwwroot/book.crifan.com Virtual Host Directory: /home/wwwroot/book.crifan.com Allow Rewrite rule? (y/n) n You choose rewrite: none Allow access log? (y/n) n Disable access log. Create database and MySQL user with same name (y/n) n Add SSL Certificate (y/n) y 1: Use your own SSL Certificate and Key 2: Use Let's Encrypt to create SSL Certificate and Key Enter 1 or 2: 2 Please enter your email address: [email protected] It will be processed automatically. Press any key to start create virtul host... Create Virtul Host directory...... set permissions of Virtual Host directory...... You select the exist rewrite rule:/usr/local/nginx/conf/none.conf Test Nginx configure file...... nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful Reload Nginx...... Gracefully shutting down php-fpm . done Starting php-fpm done You select the exist rewrite rule:/usr/local/nginx/conf/none.conf Test Nginx configure file...... nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful Reload Nginx...... /bin/certbot [found] Starting create SSL Certificate use Let's Encrypt... Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Obtaining a new certificate Performing the following challenges: http-01 challenge for book.crifan.com Using the webroot path /home/wwwroot/book.crifan.com for all unmatched domains. Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/book.crifan.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/book.crifan.com/privkey.pem Your cert will expire on 2018-03-06. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le Let's encrypt crontab renew rule is exist. Let's Encrypt SSL Certificate create successfully. Test Nginx configure file...... nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful Reload Nginx...... ================================================ Virtualhost infomation: Your domain: book.crifan.com Home Directory: /home/wwwroot/book.crifan.com Rewrite: none Enable log: no Create database: no Create ftp account: no Enable SSL: yes =>Let's Encrypt ================================================ </code>
再去看看:
<code>[root@crifan wwwroot]# lnmp vhost list +-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | https://lnmp.org | +-------------------------------------------+ Nginx Virtualhost list: book.crifan.com www.crifan.com [root@crifan wwwroot]# </code>
里面有:
然后去弄个html看看是否正常加载:
index.html
<code><!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <title>测试book二级域名</title> </head> <body> <h1>book.crifan.com域名成功加载</h1> </body> </html> </code>
去访问:
看看结果:
是可以正常加载的。