打印/下载
Nginx
Composer
交换分区

Nginx虚拟主机

upstream demo_php_websocket {
    server 127.0.0.1:9011;
}

server {
    listen       80;
    server_name  demo.webmis.vip;
    set $root_path /xxx/base/phalcon/public;
    root $root_path;
    index index.php;

    charset utf-8;

    try_files $uri $uri/ @rewrite;
    location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=/$1;
    }
    location ~* ^/(webmis|upload|themes|favicon.png)/(.+)$ {
        root $root_path;
    }
    location /wss {
        proxy_pass http://demo_php_websocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
    }

    location ~ \.php$ {
        fastcgi_pass   unix:/var/opt/remi/php74/run/php-fpm/www.sock;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

重启Nginx

systemctl reload nginx

启动Socket

ln -s /usr/bin/php74 /usr/bin/php
./webmis.sh socketStart

安装 Composer

# 下载
php74 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# 安装
sudo php74 composer-setup.php --install-dir=/usr/local/bin --filename=composer
# 查看
composer -V

依赖包

# 项目
cd /xxx/phalcon
# 依赖包
composer install

创建交换分区

# 创建分区文件
dd if=/dev/zero of=/swapfile bs=1M count=4096

# 生成SWAP
mkswap /swapfile

# 激活SWAP
swapon /swapfile

# 添加到分区列表
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab

# 查看
free -m

CentOS(阿里云)

vi /etc/sysctl.conf

vm.swappiness = 60

# 重启服务器
reboot
{{copy}}