歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> LAMP 環境搭建 C7

LAMP 環境搭建 C7

日期:2017/3/3 11:25:36   编辑:Linux技術

#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';

本文出自 “一路向北” 博客,請務必保留此出處http://centos7.blog.51cto.com/7764677/1827377

Copyright © Linux教程網 All Rights Reserved