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_interval = 1m
##修改修改PHP -FPM pool.d中的www檔
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
重啟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)"
以上是php之Ubuntu伺服器設定方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!