Ubuntu服务器初始化

in 后端 with 0 comment
#!/usr/bin/env bash

# update is used to download package information from all configured sources.
# upgrade is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list

apt-get update && apt-get -y upgrade

apt-get install -y nginx php php-dev

apt-get install -y php-mysql php-mysql php-gd php-mcrypt php-curl php-redis php-mbstring php-gmp

#注意可能替换成对应版本的php
apt-get install php-sqlite3

apt-get install -y subversion redis-server 

# 默认配置即可,拦截ssh攻击
apt-get install -y fail2ban lrzsz

# input password
apt-get install -y mysql-server


# server optimize
# cron 记录日志
# vim /etc/rsyslog.d/50-default.conf
# cron.*              /var/log/cron.log #将cron前面的注释符去掉


# step0: 修改php ,php-fpm,nginx 配置文件,适配机器性能,提高安全性
# php.ini expose_php = Off
# php.ini post_max_size = 16M
# php.ini upload_max_filesize = 16M

# php-fpm 20~30M
# 1G RAM (nginx,php)   1024/2/30

pm.max_children = 24
pm.start_servers = 16
pm.min_spare_servers = 8
pm.max_spare_servers = 24
pm.max_requests = 10000

# nginx
# server_tokens off;

# if laravel project
# apache: /etc/apache2/envvars
# export APP_ENV=testing
# nginx
# fastcgi_param  APP_ENV    testing; #Laravel 环境变量

# step1: redis 修改 bind 和添加密码

# step2: php 安装 swoole 扩展
pecl install swoole

# step3: php 安装 beast 扩展

Comments are closed.