LoginSignup
9
14

More than 5 years have passed since last update.

LAMP設定(CentOs7 + PHP7 +MariaDB)

Last updated at Posted at 2016-01-26

準備(CentOs7 のインストールと設定)

  http://www.tecmint.com/centos-7-installation/;

1.ファイアウォールを設定、ポット80と3306を開く

 1)firewalld停止
 systemctl stop firewalld.service #firewalld停止
 systemctl status firewalld #firewalld停止確認
 systemctl disable firewalld.service #firewalld自動起動停止

2)iptablesをインストール、設定
 yum install iptables-services #インストール
 vim /etc/sysconfig/iptables #編集
   以下の文言を追加:
   -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
   -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
  :wq! #保存&閉める
 systemctl restart iptables.service #再起動
 systemctl enable iptables.service #自動起動

2.Apacheをインストール

 yum install httpd
 systemctl start httpd.service
 systemctl restart httpd.service
 systemctl enable httpd.service 

 確認 ip addrでipを探す!キャプチャ.PNG

3.MariaDBをインストール、設定

 1)MariaDBをインストール
 yum install mariadb mariadb-server
 systemctl restart mariadb.service
 systemctl enable mariadb.service
 cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
2)MariaDBを設定
mysql_secure_installation
systemctl restart mariadb.service

4.PHP7をインストール、設定

1)PHP7とPhpMyAdminをインストール
http://qiita.com/100/items/8e9d9540845cc23e6111
http://thinkcmf.com/topic/topic/index/id/351.html(阿里云 Centos 7 PHP7环境配置 LNMP)
2)Apacheを設定
  vi /etc/httpd/conf/httpd.conf
  ServerSignature On #追加
  Options Indexes FollowSymLinks #変更:Options Includes ExecCGI FollowSymLinks
  #AddHandler cgi-script .cgi #変更:AddHandler cgi-script .cgi .pl
  AllowOverride None  #変更:AllowOverride All
  AddDefaultCharset UTF-8#変更
  DirectoryIndex index.html #変更:DirectoryIndex index.html index.htm Default.html Default.htm index.php
  MaxKeepAliveRequests 500 #追加
:wq!
systemctl restart httpd.service
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html
3)phpを設定
  vi /etc/php.ini
  date.timezone =
  expose_php = Off
  short_open_tag = ON
  open_basedir = .:/tmp/
  :wq!
  systemctl restart mariadb.service
  systemctl restart httpd.service

テスト

 cd /var/www/html
 vi index.php
  <?php
   phpinfo();
  ?>
 :wq!

9
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
14