Centos 7.2 x86_64上yum安裝LNMP,平常調試,小記php
1,安裝PHP7.1.10
yum install -y epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install -y php71w php71w-bcmath php71w-common php71w-cli php71w-mysql php71w-pdo php71w-gd php71w-fpm php71w-intl php71w-mbstring php71w-mcrypt php71w-process php71w-pear php71w-xml php71w-xmlrpc php71w-opcache php71w-develcss
sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php.ini
sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' /etc/php.ini
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' /etc/php.ini
sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=1@' /etc/php.ini
sed -i 's@^expose_php = On@expose_php = Off@' /etc/php.ini
sed -i 's@^request_order.*@request_order = "CGP"@' /etc/php.ini
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 16M@' /etc/php.ini
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' /etc/php.inihtml
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpmmysql
2,安裝mysql5.7.20
rpm -Uvh http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
yum install -y mysql-community-servernginx
mysql的基礎配置(根據系統硬件配置)my.cnf
[client]
port = 3306
default-character-set=utf8web
[mysqld]
port = 3306
user = mysql
skip-name-resolve=ON
character-set-server=utf8
skip-external-locking
max_connections=1000
max_connect_errors=10
default-storage-engine=INNODB
innodb_file_per_table = 1
innodb_buffer_pool_size = 1024M
innodb_log_file_size = 256M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 60
innodb_flush_method=O_DIRECT
innodb_purge_threads = 1sql
default-time-zone = '+8:00'
event_scheduler=ON
open_files_limit=51200
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4Mcentos
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2Mphp7
[mysqldump]
quick
max_allowed_packet = 500Mphp-fpm
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld
grep "temporary password" /var/log/mysqld.log
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Uiop!789';
3,安裝nginx1.12.2
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
4,nginx和php的融合
mkdir -p /var/www/html/
chown -R nginx:nginx /var/www/html
vi /etc/nginx/conf.d/default.conf
#location / {
root /var/www/html;
index index.php index.html index.htm;
#}
location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcig_read_timeout 120;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~.*\.(js|css|html|png|jpg)$ {
expires 6h;
}
systemctl enable nginx
systemctl start nginx
systemctl status nginx
echo '<?php phpinfo(); ?>' > /var/www/html/index.php http://IP 檢驗