2019年5月6日 星期一

租用 Dedicated Server筆記

租用了一台專用主機

紀錄一下筆記:

-- 被安裝好的主機是 Centos 7.0
--起初想要自己加設 centos-webpanel,結果失敗,不行
在 wget centos-webpanel.com  的安裝檔時,一直下載不到 ,.... time out
我在其他 vps就很順利
很奇怪?!

-- 後來要求安裝 DirectAdmin,並移動我的 wordpress網站,他們服務人員就幫我安裝了
幫我設好了

-- 我在自己手動修改 wordpress 的 wp-config 檔、資料庫mysql重建、備份復原
這裡也搞了好久!不熟悉,所以邊研究、邊做

-- 終於可以跑起來 wordpress 網站了,可是我自己用Codecharge寫的php程式,產生 http error 500的錯誤,懷疑是 php 7.2.18的關係

-- 為了試試看,只好再研究,如何降級 php 7.2.18 => 5.6.36

-- 發信給主機服務,他回答說可以參考
https://help.directadmin.com/item.php?id=345
https://www.vultr.com/docs/using-multiple-php-versions-on-directadmin

-- 此時我才知道, DirectAdmin Server 有一個 custombuild 這種東西
好像 DA主機上的軟體、Apache, mysql, php 等,都是由這個軟體來管理的。
難怪之前用 yum 都沒有!

參考資料:

cd /usr/local/directadmin/custombuild
vi options.conf
修改参数 php1_release=的值,例如 php1_release=5.5 ,然后保存,再执行
./build clean
./build update
./build php n
等待完成后,就可以执行php -v查看php的版本了。
注意: 由于是重新执行编译安装,有可能需要较长时间,建议在执行所有命令前,先结合使用screen场景命令。以免中途断开造成失败。

--照這個做:

Using Multiple PHP Versions on DirectAdmin

Published on: Tue, Oct 18, 2016 at 6:41 pm EST
DirectAdmin has support for running two PHP versions alongside each other. Currently, the most popular combination is PHP 5.6 and 7.0. This way, you can support both legacy software as well as very new and up-to-date software.
In this tutorial, we will be using CustomBuild to run two PHP versions.
Prior to following this tutorial, you will need to make sure you are running CustomBuild 2.0. If this is not the case, please verify and update if needed. A step-by-step guide of how to do this can be found here.
Note: PHP 7 is only supported by DirectAdmin 1.50.1 and newer.

Step 1: Altering the CustomBuild configuration

There are two ways to alter the CustomBuild configuration: directly modifying the options.conf file or using the command line. In this guide, we will be using the command line.
In order to set the two PHP versions 5.6 and 7.0, first navigate to the CustomBuild folder:
cd /usr/local/directadmin/custombuild

Step 2: Setting the PHP versions

Next, run the following commands in order to set the versions:
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php1_release 7.0
./build set php2_release 5.6
Note: Using the above example, both PHP versions will be run in php-fpm mode. This is required if you are using an Nginx and Apache reverse proxy. If you are not using a reverse proxy, you can change the PHP mode if needed.
Using PHP versions older than 5.6 is strongly discouraged as they have all reached their end of life (EOL), thus and no longer updated or maintained. As such, it is recommended that you use PHP 7 whenever possible, and use 5.6 purely for being able to temporarily support legacy applications.
Open the options.conf file:
cd /usr/local/directadmin/custombuild
vi options.conf
Verify the first few lines match or occur at least once throughout the file:
php1_release=7.0
php1_mode=php-fpm
php2_release=5.6
php2_mode=php-fpm
If not, please rerun the commands above.

Step 3: Recompiling PHP

Recompile PHP and rewrite the configurations:
./build php n
./build rewrite_confs
This can take a long time, please don't interrupt the process. It is perhaps best if you ran the commands in a screen session, and detach while the process is running in case your SSH session gets disconnected or interrupted.

Step 4: Setting the PHP versions

You are now able to select a PHP version per virtual host (website). All websites currently running on your DirectAdmin server will use the value set for php1_release. In order to alter the PHP version per website, navigate to the User Level, select the domain name, click "Domain Setup" under "Your Account", click the domain name and scroll down. As demonstrated in the screenshot below, you will now be able to choose a PHP version. Note that after changing the version, it can take up to 1 minute to process the changes. A scheduled restart of the web server is added to the DirectAdmin task queue.
Thank you for reading our guide. You now have a DirectAdmin server running two PHP versions!
======================
結果:
我的 cd /usr/local/directadmin/custombuild
vi options.conf
php1_release=7.2
php1_mode=mod_php
php2_release=5.6
php2_mode=php-fpm
[root@server custombuild]# ./build php n
....... 跑很久.....
[root@server custombuild]# ./build rewrite_confs
Your license OS (CentOS 6) does not match the OS installed (CentOS 7).
Checking to ensure /etc/httpd/conf/ssl.crt/server.ca is set.
Using 162.210.98.121 for your server IP
**************************************

Apache 2.4.27 and higher will not negotiate http2 with mpm_prefork. Please do not use mod_php or disable http2 in the directadmin.conf
http://www.apache.org/dist/httpd/CHANGES_2.4.27

**************************************
Restarting apache.

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

--- 研究  nginx + apache 組合,

26. How do I switch to nginx+apache combination? (nginx running in front of apache)
Code:
cd /usr/local/directadmin/custombuild
./build update
./build set webserver nginx_apache
./build nginx_apache
./build rewrite_confs

-- 查 custombuild version
cd /usr/local/directadmin/custombuild
./build version

-- 重启APACHE

service httpd restart

成功了!








TO DO:
What is screen 場景命令?
Linux 不熟,有好多東西在研究!

SPAM fighting tools in DirectAdmin




哇!被稱為面板之神,方便到了極點?!http://www.baddb.com/51.html




DirectAdmin面板之神插件custombuild(2.0)


  • 目前的版本是 custombuild v2.0.0 ,安装directadmin后默认其实已经自带安装了custombuild功能,但是仅为指令化方式使用。
  • custombuild帮助directadmin使用者以最简单的方式安装和生产调整环境版本,几乎囊括所有主要的主流程序以及版本,方便到了极点。
可以在安装有directadmin面板的环境中执行以下命令行来查看是否安装有custombuild及custombuild的具体版本
custombuild版本检测:
/usr/local/directadmin/custombuild/build version
如果使用的还是v1.*版本,可以按照directadmin官方文档进行升级到 custombuild v2.0
具体参考文档 https://help.directadmin.com/item.php?id=555

沒有留言:

張貼留言

如何判斷現在FORM是在 insert mode? 還是 update mode?

只要用  if (empty({primary_key})) 就可以知道是否為新增模式了。 如果 {promary_key} 是空白的,那麼就是在新增模式;反之,就是更新模式。 以上。