スティーブジョブスに俺はなる!!

毎日全力を出し切り、自分史上最高を出し続けたい!

1からLinuxに本番環境の設定をする CentOS(4)Apache2.2を2.4にアップデートする。

Apache2.2のサービスを停止してApache2.4のサービスを起動する

まずApache2.2がプレインストールされていたのでサービスを停止する

$ chkconfig httpd off
$ chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off

Apache2.4が入ってるレポジトリをダウンロード

$ cd /etc/yum.repos.d/
$ wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
sudo: wget: コマンドが見つかりません

 

wgetをインストール

$ yum install wget

 

再度ダウンロード

$ wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo

これでyumを使ってインストールできる

$ sudo yum install httpd24.x86_64

インストールできたか確認

$ /opt/rh/httpd24/root/usr/sbin/httpd -version
Server version: Apache/2.4.6 (Red Hat)
Server built:   Sep 25 2013 05:25:46

ちなみに、configファイルの位置(格納場所)

/opt/rh/httpd24/root/etc/httpd

httpd2.4のサービス起動

$ sudo chkconfig httpd24-httpd on
$ chkconfig --list | grep httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd24-httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

どうやら、php-fpmというのも入れたほうがいいらしい

http://wiki.apache.org/httpd/PHP-FPM

とりあえず、入れてみる

$ yum install php-fpm
$ sudo /etc/init.d/php-fpm start
php-fpmを起動中: [ OK ]
$ chkconfig php-fpm --list
php-fpm 0:off 1:off 2:off 3:off 4:off 5:off 6:off
$ chkconfig php-fpm on
$ chkconfig php-fpm --list
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off

設定ファイルの変更

まずはバックアップ

$ cd

$ mkdir backup

$ cp -p /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf ./backup/httpd.conf

 

設定変更

$ sudo vi /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

 

変更1:連絡先メールアドレス、公開できる連絡用メールアドレスを設定

# ServerAdmin: Your address, where problems with the server should be

# e-mailed.  This address appears on some server-generated pages, such

# as error documents.  e.g. admin@your-domain.com

#

ServerAdmin root@localhost

 

変更2:Options indexesを無効化、indexesの前に-(ハイフン)を付ける、FollowSymLinksの前には+(プラス)を付ける

<Directory "/opt/rh/httpd24/root/var/html">

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

    # for more information.

    #

    Options -Indexes +FollowSymLinks

 

Apacheが起動できるかテストする

$ sudo service httpd24-httpd restart

Stopping httpd:                                            [FAILED]

Starting httpd:                                            [  OK  ]

 

テストページが表示されている事をブラウザから確認する。

http://の後にサーバのIPアドレスもしくはドメインを入力してアクセスする。

Red Hat Enterprise Linux Test Page

[ Powered by Apache ]

テストページが表示されていればOK

 

 

1からLinuxに本番環境の設定をする CentOS

1からLinuxに本番環境の設定をする CentOS(1) 

1からLinuxに本番環境の設定をする CentOS(2)セキュリティ

1からLinuxに本番環境の設定をする CentOS(3)iptable logwatch

1からLinuxに本番環境の設定をする CentOS(4)Apache2.2を2.4にアップデートする

1からLinuxに本番環境の設定をする CentOS(5)Gitのインストールと設定

1からLinuxに本番環境の設定をする CentOS(6)gitoliteでリポジトリ運用開始

1からLinuxに本番環境の設定をする CentOS(7)tomcat7 インストール

1からLinuxに本番環境の設定をする CentOS(8)tomcat8 インストール 

 

 

 

参考にしたブログ

yumでアンインストールしたい

CentOS - install using yum Apache 2.4 - Unix & Linux Stack Exchange