#LAMP环境搭建Centos 7
(1)安装开发包组 “Development Tools” “Server Platform Development”
yum groupinstall
注:关闭selinux iptables
(2)安装amp
(a)yum install httpd php php-mysql mariadb mod_ssl
(b)https://xcache.lighttpd.net/ 下载 xcache
tar xvf xcache-3.2.0.tar.gz
运行/usr/bin/phpize
./configure --enable-xcache --with-php-config=/usr/bin/php-config
(c)解压 wordpress ,phpMyAdmin
(3)对文件进行配置
(a)模块选择
配置文件位置:/etc/httpd/conf.modules.d/00-mpm
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_worker_module modules/mod_mpm_worker.so
注:当选择event worker 模块时 要按照phplib5-zts.so
(b)httpd配置 备份:httpd.conf 及虚拟主机conf
对需要使用HTTPS的域名进行配置
1)生成私钥,并申请证书
2)配置vhost /etc/httpd/conf.d/ssl.cof
<VirtualHost 172.16.174.177:443>
DocumentRoot "/data/vhost/amp2"
ServerName amp2.magedu.com
SSLCertificateFile /etc/pki/tls/certs/httpd.crt
SSLCertificateKeyFile /etc/pki/tls/private/httpd.key
注意:amp2.conf 不要单独新建文件 直接加在ssl.conf中
Listion 172.16.174.177:80
User apache
Group apache
<VirtualHost 172.16.174.177:80>
ServerName amp1.magedu.com
DocumentRoot /data/vhost/amp1
CustomLog logs/access_amp1_log combined
ErrorLog logs/error_amp1_log
DirectoryIndex index.php index.html
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/wordpress/$1
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
注意:prefork默认
StartServers 7
MinSpareServers 4
MaxSpareServers 21
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
worker默认
StartServers 5
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
<Directory "/data/vhost/amp1">
Options None
AllowOverride None
Require all granted
</Directory>
Alias /wordpress/ "/data/wordpress/"
<Directory "/data/wordpress">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
(c)mariadb的配置 php
myql:/etc/my.cnf
php :/etc/php.ini /etc/php.d/*.ini
(d)配置wrodpress
cd wordpress cp wp-config-sample.php wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define(‘DB_NAME‘, ‘testdb‘);
/** MySQL数据库用户名 */
define(‘DB_USER‘, ‘testuser‘);
/** MySQL数据库密码 */
define(‘DB_PASSWORD‘, ‘testpass‘);
/** MySQL主机 */
define(‘DB_HOST‘, ‘172.16.174.170‘);
(e)配置wordpress
cp config.sample.inc.php config.inc.php
/* User used to manipulate with storage */
// $cfg[‘Servers‘][$i][‘controlhost‘] = ‘172.16.174.177‘;
// $cfg[‘Servers‘][$i][‘controlport‘] = ‘3306‘;
// $cfg[‘Servers‘][$i][‘controluser‘] = ‘testuser‘;
// $cfg[‘Servers‘][$i][‘controlpass‘] = ‘testpass‘;