API 服务器调教
sudo apt-get install language-pack-zh-hans sudo vim /etc/default/locale# vim /etc/default/locale 输入以下内容LANG="en_US.UTF-8"LANGUAGE="zh_CN.utf8"LC_ALL="zh_CN.utf8"
sudo apt-get install -y software-properties-common python-software-propertiessudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install -y php7.1 php7.1-mysql php7.1-curl php7.1-mbstring php7.1-gd php7.1-xml php7.1-soap php-pear php7.1-dev php7.1-zip php7.1-fpm
7.2有一个问题: Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/CPC-API/library/Zend/Session.php on line 205
sudo apt-get install -y php7.2 php7.2-mysql php7.2-curl php7.2-mbstring php7.2-gd php7.2-xml php7.2-soap php-pear php7.2-dev php7.2-zip
sudo apt-get remove "php7.2*"
参考:http://nginx.org/en/linux_packages.html
wget http://nginx.org/keys/nginx_signing.keysudo apt-key add nginx_signing.keysudo vim /etc/apt/sources.list####### 加入以下内容 ##########deb http://nginx.org/packages/ubuntu/ xenial nginx # 16.04 是 xenial,其他版本ubuntu自行查看替换xenialdeb-src http://nginx.org/packages/ubuntu/ xenial nginx # 16.04 是 xenial,其他版本ubuntu自行查看替换xenial
sudo apt-get updatesudo apt-get install nginx
wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.debsudo dpkg -i mysql-apt-config_0.8.9-1_all.deb sudo apt-get update sudo apt-get install mysql-serversudo service mysql stop
sudo apt-get install mongodb
sudo apt-get install pkg-configsudo pecl install mongodb # 如果提示出错,尝试sudo apt-get remove "php7.2*"
apache2/php.ini fpm/php.ini cli/php.ini
php.ini中添加 extension=mongodb.so
echo "extension=mongodb.so" >> /etc/php/7.1/apache/php.inisudo echo "extension=mongodb.so" >> /etc/php/7.1/cli/php.ini sudo echo "extension=mongodb.so" >> /etc/php/7.1/cli/php.ini
修改 pcre.recursion_limit=5000
max_input_vars = 20000
post_max_size = 50M
emergency_restart_threshold = 10
emergency_restart_interval = 1m
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
pm.max_children = 51
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 1000
slowlog = /var/log/$pool.log.slow
request_slowlog_timeout = 5s
重启nginx或apache还有fpm
sudo apt-get install -y git tig tree zsh nload tmux
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Atas ialah kandungan terperinci php之Ubuntu服务器设置方法. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!