安装前先进入root 户口
$ su
1. Apache 2
$ yum install httpd
$ gedit /etc/httpd/conf/httpd.conf
KeepAlive Off
<IfModule prefork.c>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>
$ gedit /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html/
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>
$ mkdir -p /var/www/example.com/public_html
$ mkdir /var/www/example.com/logs
# 重启 Apache 2
$ systemctl enable httpd.service
$ systemctl restart httpd.service
$ systemctl start httpd.service
$ systemctl status -l httpd.service
2. MySql / MariaDB
# mariadb 安装
$ yum install mariadb-server
$ systemctl enable mariadb.service
$ systemctl start mariadb.service
# mysql 安装
$ mysql_secure_installation
$ mysql -u root -p
mysql> create database webdata;
mysql> grant all on webdata.* to 'webuser' identified by 'password';
mysql> quit
3. PHP
$ yum install php php-pear
$ yum install php-mysql
# 优化 error.log 的输出
$ gedit /etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
error_log = /var/log/php/error.log
max_input_time = 30
$ mkdir /var/log/php
$ chown apache /var/log/php
# 重启 Apache 2
$ systemctl reload httpd
没有评论:
发表评论