最新消息:20210917 已从crifan.com换到crifan.org

【已解决】OneinStack更换服务器中网站的域名

更换 crifan 1700浏览 0评论
折腾:
【已解决】更换WordPress网站的域名从之前xxx换到xxx.it
期间,现在问题转换为:
之前用OneinStack搭建的(WordPress)网站
现在需要换域名,从之前的
xxx
换到
xxx.it
参考:
Welcome to use OneinStack
去看看
vhost
[root@VM_0_10_centos oneinstack]# pwd
/root/oneinstack
用:
./vhost.sh del
可以看到:
[root@VM_0_10_centos oneinstack]# pwd
/root/oneinstack
[root@VM_0_10_centos oneinstack]# ./vhost.sh del

#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 7+ and Ubuntu 12+      #
#       For more information please visit 
OneinStack - 一键PHP/JAVA安装工具
      # ####################################################################### Virtualhost list: xxx xxx_backup Please input a domain you want to delete:
去删除
Please input a domain you want to delete: xxx


Do you want to delete Virtul Host directory? [y/n]: y


Press Ctrl+c to cancel or Press any key to continue...


Domain: xxx has been deleted.
然后再去重新建一个
./vhost.sh
过程:
[root@VM_0_10_centos oneinstack]# ./vhost.sh


#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 7+ and Ubuntu 12+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################


What Are You Doing?
        1. Use HTTP Only
        2. Use your own SSL Certificate and Key
        3. Use Let's Encrypt to Create SSL Certificate and Key
        q. Exit
Please input the correct option: 3


Please input domain(example: www.example.com):
Your  is invalid!


Please input domain(example: www.example.com): www.xxx.it
domain=www.xxx.it


Please input the directory for the domain:www.xxx.it :
(Default directory: /data/wwwroot/www.xxx.it):
Virtual Host Directory=/data/wwwroot/www.xxx.it


Create Virtul Host directory......
set permissions of Virtual Host directory......


Do you want to add more domain name? [y/n]: n


Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
[Sun May  9 20:04:56 CST 2021] Creating domain key
[Sun May  9 20:04:56 CST 2021] The domain key is here: /root/.acme.sh/www.xxx.it/www.xxx.it.key
[Sun May  9 20:04:56 CST 2021] Single domain='www.xxx.it'
[Sun May  9 20:04:56 CST 2021] Getting domain auth token for each domain
[Sun May  9 20:04:56 CST 2021] Getting webroot for domain='www.xxx.it'
[Sun May  9 20:04:56 CST 2021] Getting new-authz for domain='www.xxx.it'
[Sun May  9 20:04:58 CST 2021] Could not get nonce, let's try again.
期间:
【已解决】OneinStack用vhost.sh添加域名报错:Could not get nonce, let’s try again
然后解决了:
[root@VM_0_10_centos oneinstack]# ./vhost.sh


#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################


What Are You Doing?
        1. Use HTTP Only
        2. Use your own SSL Certificate and Key
        3. Use Let's Encrypt to Create SSL Certificate and Key
        q. Exit
Please input the correct option: 3


Please input domain(example: www.example.com): www.xxx.it
domain=www.xxx.it


Please input the directory for the domain:www.xxx.it :
(Default directory: /data/wwwroot/www.xxx.it):
Virtual Host Directory=/data/wwwroot/www.xxx.it


Create Virtul Host directory......
set permissions of Virtual Host directory......


Do you want to add more domain name? [y/n]: n


Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
[Sun May  9 20:12:36 CST 2021] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Sun May  9 20:12:36 CST 2021] Create account key ok.
[Sun May  9 20:12:36 CST 2021] Registering account: https://acme-v02.api.letsencrypt.org/directory
[Sun May  9 20:12:38 CST 2021] Registered
[Sun May  9 20:12:38 CST 2021] ACCOUNT_THUMBPRINT='2IHwjOp0e1b_Rsnwzqy2bqLWWSDaH9hPdmw45zn7fpA'
[Sun May  9 20:12:38 CST 2021] Single domain='www.xxx.it'
[Sun May  9 20:12:38 CST 2021] Getting domain auth token for each domain
[Sun May  9 20:12:40 CST 2021] Getting webroot for domain='www.xxx.it'
[Sun May  9 20:12:40 CST 2021] Verifying: www.xxx.it
[Sun May  9 20:12:44 CST 2021] Pending
[Sun May  9 20:12:46 CST 2021] Success
[Sun May  9 20:12:46 CST 2021] Verify finished, start to sign.
[Sun May  9 20:12:46 CST 2021] Lets finalize the order.
[Sun May  9 20:12:46 CST 2021] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/122870768/9584402276'
[Sun May  9 20:12:48 CST 2021] Downloading cert.
[Sun May  9 20:12:48 CST 2021] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/03aa39008712780ed938992af4235f95cbe0'
[Sun May  9 20:12:49 CST 2021] Cert success.
-----BEGIN CERTIFICATE-----
MIIFITCCBxxxxxxxxxxxxxxxxxxxxxxxxxxxe/Pby1qASuDpmQc
YhGFY/v4bPbhjSQsiztKyEd9jeTE
-----END CERTIFICATE-----
[Sun May  9 20:12:49 CST 2021] Your cert is in  /root/.acme.sh/www.xxx.it/www.xxx.it.cer
[Sun May  9 20:12:49 CST 2021] Your cert key is in  /root/.acme.sh/www.xxx.it/www.xxx.it.key
[Sun May  9 20:12:49 CST 2021] The intermediate CA cert is in  /root/.acme.sh/www.xxx.it/ca.cer
[Sun May  9 20:12:49 CST 2021] And the full chain certs is there:  /root/.acme.sh/www.xxx.it/fullchain.cer


Do you want to add hotlink protection? [y/n]: n


Allow Rewrite rule? [y/n]: y


Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): wordpress
You choose rewrite=wordpress


Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/www.xxx.it_nginx.log


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......


#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################
Your domain:                  www.xxx.it
Virtualhost conf:             /usr/local/nginx/conf/vhost/www.xxx.it.conf
Directory of:                 /data/wwwroot/www.xxx.it
Rewrite rule:                 /usr/local/nginx/conf/rewrite/wordpress.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/www.xxx.it.crt
SSL Private Key:              /usr/local/nginx/conf/ssl/www.xxx.it.key
即可。
【总结】
OneinStack中,更换域名,逻辑是:
(用vhost.sh)删除就域名,创建新域名,即可。
先:
vhost.sh del
再:
vhost.sh
可参考:
Interactive installation – LEMP Stack
用:
vhost.sh
新建域名期间:
核心选项:
输入3,选:
3. Use Let's Encrypt to Create SSL Certificate and Key
表示用免费的Let’s Encrypt,帮我们自动生成SSL证书
输入域名:www.xxx.it
Please input domain(example: www.example.com): www.xxx.it
输入n,表示不用加其他更多域名:
Do you want to add more domain name? [y/n]: n
输入y,开启https的强制跳转:
Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
输入n,不用防盗链:
Do you want to add hotlink protection? [y/n]: n
输入y,允许重写规则
Allow Rewrite rule? [y/n]: y
输入wordpress,重写规则用wordpress:
You choose rewrite=wordpress
输入y,开启访问日志:
Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
即可。
另外注意:
如果新建域名没完成(比如此处由于报错Could not get nonce, let’s try again,而强制中断),则重新用:
vhost.sh
新建时会提示:
You can delete /usr/local/nginx/conf/vhost/www.xxx.it.conf and re-create
需要去删除对应配置文件:
rm -f /usr/local/nginx/conf/vhost/www.xxx.it.conf
再重试,即可。

转载请注明:在路上 » 【已解决】OneinStack更换服务器中网站的域名

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.183 seconds, using 23.35MB memory