AB Lab

abgata20000 blog.

Apache Php Mysqlをインストール(yum)

apache

1
2
3
4
sudo yum install httpd
sudo chkconfig httpd on
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
vim /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf
1
2
3
4
5
6
ServerTokens Prod
ServerSignature Off
Options Indexes → Options -Indexes FollowSymLinks
※var/www/html内のもの
ServerName www.example.com:80
NameVirtualHost *:80

設定を反映

1
2
3
sudo service httpd configtest
sudo service httpd start
chkconfig httpd on

※ヴァーチャルホストの設定を別ファイルに記載でもOK

1
2
cd /etc/httpd/conf.d
vim vhost.conf

バーチャルホスト用にフォルダを作成

1
mkdir -p /var/www/vhosts/default/public

php

1
2
3
4
yum install -y php php-devel php-mysql php-mbstring php-gd php-pear httpd-devel
php -v
cp /etc/php.ini /etc/php.ini.org
vim /etc/php.ini
/etc/php.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
error_log = /var/log/php.log
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
display_errors = On
mbstring.language = Japanese
expose_php = Off
date.timezone = Asia/Tokyo
max_execution_time = 300
magic_quotes_gpc = Off
upload_max_filesize = 200M
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = pass
mbstring.detect_order = auto
;mbstring.substitute_character = none;

max_file_uploads = 100
post_max_size = 100M
upload_max_filesize 100M

設定を反映

1
service httpd restart

mysql

1
2
3
yum install -y mysql-server
cp /etc/my.cnf /etc/my.cnf.org
vim /etc/my.cnf
/etc/my.cnf
1
2
3
4
5
6
7
8
9
10
11
[mysqld]以下に追加
character_set_server=utf8
default-storage-engine=InnoDB
innodb_file_per_table
group_concat_max_len=10000000

[mysql]
default-character-set=utf8

[mysqldump]
default-character-set=utf8

設定を反映

1
2
service mysqld start
chkconfig mysqld on

mysqlの初期設定

1
2
mysql_secure_installation
mysql -u root -p