Tagged: vestacp Toggle Comment Threads | 快速鍵

  • starway 3:24 pm on March 11, 2019 固定鏈結 | 回應
    Tags: vestacp   

    How to Install PHP OPCache APC/APCu Memcached and Redis on VestaCP CentOS 

    來源:https://www.mysterydata.com/how-to-install-php-opcache-apc-apcu-memcached-and-redis-on-vesta-cp-centos/

    In this tutorial we’ll implement and install various type of opcache and object cache in order to increase the performance of your websites and lower the loads for server.

    OPCache and object cache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

    In other words, a PHP script when it is executed, is compiled into opcode/object cache (memcache and redis), code that is understandable by the machine. OPCache and object cache stores this code into memory on the first execution, to be reused afterwards, thus leading to performance boosts.

    Lets get Started :

    First install Remi repo :

    CentOS 7

    wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    rpm -Uvh remi-release-7.rpm
    

    CentOS 6

    wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
    rpm -Uvh remi-release-6.rpm

    To install Zend Opcache :

    OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

    yum install php-opcache
    

    After installation you need to restart Apache/php-fpm :

    if you’re using Apache (mod_php) :

    service httpd restart
    

    If you’re using PHP-FPM :

    service php-fpm restart
    

    To install APC/APCu :

    APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.

    yum install php-pecl-apcu
    

    After installation you need to restart Apache/php-fpm :

    if you’re using Apache (mod_php) :

    service httpd restart
    

    If you’re using PHP-FPM :

    service php-fpm restart
    

    To install Memcached :

    Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

    For PHP 5.xx

    yum install memcached memcached-devel php-pecl-memcache
    

    For PHP 7.xx

    yum install memcached memcached-devel php-pecl-memcached
    

    Start memcached Service :

    service memcached start
    

    Start the memcached on boot :
    Centos 6 :

    chkconfig memcached on
    

    Centos 7 :

    systemctl enable memcached
    

    After installation you need to restart Apache/php-fpm :

    if you’re using Apache (mod_php) :

    service httpd restart
    

    If you’re using PHP-FPM :

    service php-fpm restart
    

    To install Redis :

    Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

    yum install redis php-pecl-redis
    

    Start Redis Service :

    service redis start
    

    Start the Redis on boot :
    Centos 6 :

    chkconfig redis on
    

    Centos 7 :

    systemctl enable redis
    

    After installation you need to restart Apache/php-fpm :

    if you’re using Apache (mod_php) :

    service httpd restart
    

    If you’re using PHP-FPM :

    service php-fpm restart
    
    廣告
     
  • starway 9:48 am on March 8, 2019 固定鏈結 | 回應
    Tags: vestacp   

    How to Upgrade PHP 5.6 to PHP 7.3 on CentOS VestaCP 

    來源:https://www.mysterydata.com/how-to-upgrade-php-5-6-to-php-7-3-on-centos-vestacp/

    In this tutorial I’ll show you how to upgrade PHP 5.6.xx which is by default installed by Vesta CP during installation to PHP 7.3.xx latest, I’ve tested on many server before writing this tutorial and its just working fine without any issue hence it is safe to upgrade to PHP 7.3 please be sure your script is compatible with php 7.3, part of this tutorial is copied from remi repository.

    Why upgrade to php 7.3 –  Because it will give you security & performance boost + KICK, since WordPress will load much faster and uses less resources. And php 7.3 is 5% faster than any other previous version.

    Upgrade to php 7.2 : https://www.mysterydata.com/upgrade-php-5-6-php-7-2-centos-vesta-cp/

    STEP 1 :

    Install Remi Repository and EPEL Repository on your server :

    RHEL 7

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
    subscription-manager repos --enable=rhel-7-server-optional-rpms

    RHEL 6

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
    rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
    rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6

    CentOS 7

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
    

    CentOS 6

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
    rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm

    STEP 2 :

    After you have installed repository you need to follow some extra configurations :

    Run this command one by one for RHEL or CentOS

    yum install yum-utils
    yum-config-manager --enable remi-php73

     STEP 3 :

    Now just run this command :

    yum update -y

    You’ll see php packages are getting updated, After the update process you need to restart Apache server/php-fpm-(nginx) and check the php version from by below mentioned command:

    php -v
    [root@server ~]# php -v
    PHP 7.3.0 (cli) (built: Dec  4 2018 16:12:20) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies
    

    Troubleshoot

    If php upgrade process fails (no update/nothing happens) or you upgraded previously from 5.6 to 7.0/7.1/7.2 then you need to run this commands to disable php 5.6/7.0/7.1/7.2 :

    yum-config-manager --disable remi-php56
    yum-config-manager --disable remi-php70
    yum-config-manager --disable remi-php71
    yum-config-manager --disable remi-php72
    

    After that follow the tutorial from STEP 2 again.

     
  • starway 9:54 pm on September 22, 2017 固定鏈結 | 回應
    Tags: vestacp   

    roundcube 連線到 imap 伺服器失敗 

    nano /etc/dovecot/dovecot.conf

    Add the following:
    namespace inbox {
    inbox = yes
    }

     
  • starway 7:05 pm on July 3, 2017 固定鏈結 | 回應
    Tags: vestacp   

    log size 大小 

    cd /etc/logrotate.d

    nano nginx

    增加SIZE

    size 10M

     
  • starway 2:39 pm on July 3, 2017 固定鏈結 | 回應
    Tags: vestacp   

    [HOWTO] Recompile NGINX with OpenSSL 1.0.2+ for HTTP/2 via ALPN on Debian 8 Topic is solved 

    特別注意:

    每個版本 nginx 搭配 openssl
    會有成功與失敗 不同的結果
    要注意

    ===========================================================

    參考文件:

    http://hg.nginx.org/njs/archive/njs-63d7430291f2.zip

    ===========================================================

    nginx -V

    yum install gc gcc gcc-c++ pcre-devel zlib-devel make wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel gperftools gperftools-devel libatomic_ops-devel perl-ExtUtils-Embed -y

    cd /usr/local/src/

    wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz

    tar zxf openssl-1.1.0e.tar.gz

    wget https://nginx.org/download/nginx-1.12.0.tar.gz

    tar zxf nginx-1.12.0.tar.gz

    cd nginx-1.12.0

    service nginx stop

    ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –modules-path=/usr/lib64/nginx/modules –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-compat –with-file-aio –with-threads –with-http_addition_module –with-http_auth_request_module –with-http_dav_module –with-http_flv_module –with-http_gunzip_module –with-http_gzip_static_module –with-http_mp4_module –with-http_random_index_module –with-http_realip_module –with-http_secure_link_module –with-http_slice_module –with-http_ssl_module –with-http_stub_status_module –with-http_sub_module –with-http_v2_module –with-mail –with-mail_ssl_module –with-stream –with-stream_realip_module –with-stream_ssl_module –with-stream_ssl_preread_module –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC’ –with-ld-opt=’-Wl,-z,relro -Wl,-z,now -pie’ –with-openssl=/usr/local/src/openssl-1.1.0e

    make & make install

    service nginx restart

    nginx -V

    ==============================================================
    最後修改樣板

    cd /usr/local/vesta/data/templates/web/nginx/

    nano force-https.stpl

    server {
    listen %ip%:%proxy_ssl_port%;
    改成
    server {
    listen %ip%:%proxy_ssl_port% http2;

    參考文件:
    https://forum.vestacp.com/viewtopic.php?f=11&t=13150&p=55968&hilit=http2#p55968

     
  • starway 11:03 am on July 3, 2017 固定鏈結 | 回應
    Tags: vestacp   

    vestacp 

    文件 https://vestacp.com/docs/
    樣板路徑 /usr/local/vesta/data/templates/web/nginx/

     
  • starway 2:12 pm on June 28, 2017 固定鏈結 | 回應
    Tags: vestacp   

    ssl 續用修正 

    touch /usr/local/vesta/data/queue/letsencrypt.pipe
    chmod 750 /usr/local/vesta/data/queue/letsencrypt.pipe

     
    • starway 3:06 下午 on 六月 28, 2017 固定鏈結

      新版已經不用修正了 以更正

  • starway 3:31 am on June 10, 2017 固定鏈結 | 回應
    Tags: vestacp   

    vestacp CRON jobs 

    https://forum.vestacp.com/viewtopic.php?t=5599

    wget -q –spider https://xxxx.xxx/xx.php > /dev/null 2>&1

    wget -q –spider <== -q 安靜模式 –spider 不下載東西 ,一定要加不然會多一堆紀錄檔案

    > /dev/null 2>&1 <==表示不寄信,一定要加不然會收到爆

     
  • starway 3:06 am on June 10, 2017 固定鏈結 | 回應
    Tags: vestacp   

    如何修改phpmyadmin url 網址 

    Change Link to PhpMyAdmin (nginx, apache)

    http://vestacp.com/docs/#config-log-location-rhel-centos

    修改
    nano /etc/httpd/conf.d/phpMyAdmin.conf

    Alias /phpMyAdmin /usr/share/phpMyAdmin
    Alias /phpmyadmin /usr/share/phpMyAdmin
    範例
    改/phpMyAdmin -> /phpmyadmin-xxxx
    改/phpmyadmin -> /phpmyadmin-xxxx

    service httpd restart

    =======================================
    Change Link to PhpMyAdmin (nginx, php-fpm)

    nano /etc/nginx/conf.d/phpmyadmin.inc

    修改
    phpMyAdmin

    這邊有說明圖片:
    https://prnt.sc/ha2ceh

    service nginx restart

     
  • starway 9:23 pm on May 27, 2017 固定鏈結 | 回應
    Tags: vestacp   

    安裝 Vesta 

    安裝 Vesta
    curl -O http://vestacp.com/pub/vst-install.sh
    bash vst-install.sh
    ==================================
    How to force https/SSL on a domain
    1. Install custom nginx template
    cd /usr/local/vesta/data/templates/web
    wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz
    tar -xzvf nginx.tar.gz
    rm -f nginx.tar.gz
    ==================================
    To get SSL working for your VestaCP:
    (如果一開始主機沒設網域時才使用)

    You can do the following:

    CODE: SELECT ALL
    mv /usr/local/vesta/ssl/certificate.crt /usr/local/vesta/ssl/certificate.crt.backup

    CODE: SELECT ALL
    mv /usr/local/vesta/ssl/certificate.key /usr/local/vesta/ssl/certificate.key.backup

    CODE: SELECT ALL
    nano /usr/local/vesta/ssl/certificate.crt #paste your crt -> save.
    CODE: SELECT ALL
    nano /usr/local/vesta/ssl/certificate.key #paste your key -> save.

    CODE: SELECT ALL
    service vesta restart
    ==================================

    ################################################################

    項目 1. centos 安全設定

    1.建立新帳號密碼
    adduser 帳號
    passwd 帳號
    ex:
    adduser admin <==新增帳號
    passwd admin <==修改帳號admin 密碼

    2.停用root ssh登入
    編輯 /etc/ssh/sshd_config
    nano /etc/ssh/sshd_config
    尋找:
    #PermitRootLogin yes
    修改為:
    PermitRootLogin no
    最後輸入以下指令重新啟動
    systemctl restart sshd.service

    項目 2. 每天自動更新
    yum -y update
    yum -y install cronie
    yum -y install yum-cron

    編輯 /etc/yum/yum-cron.conf
    nano /etc/yum/yum-cron.conf
    尋找:
    apply_updates = no
    修改為:
    apply_updates = yes

    確認一下 update_messages = yes, download_updates = yes, apply_updates = yes

    最後,啟動 crond 和 yum-cron:
    systemctl start crond
    systemctl start yum-cron

    項目 3. 修改防火牆 fail2ban

    nano /etc/fail2ban/jail.conf

    [sshd]
    enabled = true
    port = ssh
    filter = sshd
    logpath = /var/log/auth.log
    maxretry = 5 # 最多幾次 (改成 3 次)
    findtime = 600 # 時間區間
    bantime = 1200 # 要 ban 多久 (改成86400 一天)
    .
    service fail2ban restart

    相關於文件參考:
    https://newtoypia.blogspot.tw/2016/04/fail2ban.html
    http://www.vixual.net/blog/archives/252

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
回應
e
編輯
o
Show/Hide comments
t
至頂
l
Go to login
h
Show/Hide help
shift + esc
取消