顯示具有 網站管理 標籤的文章。 顯示所有文章
顯示具有 網站管理 標籤的文章。 顯示所有文章

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

2019年3月12日 星期二

自架mail server,email收不到?

自架的 mail server,奇怪的是:發信正常,但收信就都收不到?!

幾經查詢、檢查設定

發現:原來是 email  routing 設定錯誤。
email routing 可以是 remote/local
正常應該是 local,而現在是 remote,改成 local 就可以了!

紀錄一下

2018年12月5日 星期三

架設伺服主機

幫朋友架設Linux主機,很少架設linux主機,之前幫公司架,已經是三年前的事了。而且是用 ubuntu 6.0架的。後來查到有 Centos-Webpanel 可以用,所以就想說架 Centos

第一次下載了 minimal 版的 centos 7.0
摸索了半天,用 win32diskimager 來建立 centos 的usb開機安裝,搞了半天
........
中間錯誤的過程就不記載了
直接紀錄成功簡單的路徑就好。

用最 minimal 的安裝。

將網路設定好,可以往外連線。

然後,依據 Centos-webpanel.com 的指示,一步一步執行。

http://centos-webpanel.com/installation-instructions

記得,要將最後完成的畫面記錄下來,有sql server 密碼,還有登入資訊

設定好基地台虛擬伺服器的 ip/udp :2030

測試一下就好了!

2018年9月14日 星期五

CSRF

CSRF 是一種 Web 上的攻擊手法,全稱是 Cross Site Request Forgery,跨站請求偽造。

https://blog.techbridge.cc/2017/02/25/csrf-introduction/


2013年5月17日 星期五

登入 WHM 產生Login Invalid

我的主機在美國,我都是透過主機商提供的WHM/cPanel來管理主機,然而,有時候就是會發生無法登入的情形。

我可以很明確的確定我輸入的帳號密碼是正確的,然而,還是無法登入,訊息是:The Login is Invalid,登入無效!

後來在網路上爬文,搜尋資料,終於找到解決方法了。

原來,WHM/cPanel對於登入有安全性管控,如果有異常的登入就會將IP記錄下來,不讓你再登入了!

解決方法就是進入到資料庫中將相關的紀錄刪除,就可以了。

如下:

使用SSH登入到主機,我是用PUTTY

#mysql

mysql>use cphulkd;

mysql>show tables;

mysql>delete from brutes;

mysql>exit;


就這樣,重新登入就可以了。

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

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