본문 바로가기
구 블로그 보관처

LINUX - APM - Apache, PHP 설치

by 행복한 만수킴 2020. 5. 17.

 



  • Apache와 PHP 설치
    • 다른데는 따로 설치하는 설명이 많은데, 3Rabbitz님은 한방에 설치하네요.
      yum --enablerepo=epel,rpmforge,remi install php php-common php-pear php-pdo php-mysql php-gd php-mbstring php-mcrypt php-xml
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
      100
      101
      102
      103
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      124
      125
      126
      127
      128
      129
      130
      131
      132
      133
      134
      135
      136
      137
      138
      139
      140
      141
      142
      143
      144
      145
      146
      147
      148
      149
      150
      151
      152
      153
      154
      155
      156
      157
      158
      159
      160
      161
      162
      163
      164
      165
      166
      167
      168
      169
      170
      171
      172
      173
      174
      175
      176
      177
      178
      179
      180
      181
      182
      183
      184
      185
      186
      187
      188
      189
      190
      191
      [root@centos ~]# yum --enablerepo=epel,rpmforge,remi install php php-common php-pear php-pdo php-mysql php-gd php-mbstring php-mcrypt php-xml
      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
      Excluding mirror: data.nicehosting.co.kr
       * base: centos.mirror.cdnetworks.com
       * epel: mirror.premi.st
      Excluding mirror: data.nicehosting.co.kr
       * extras: centos.mirror.cdnetworks.com
       * remi: remi.kazukioishi.net
       * rpmforge: ftp.kddilabs.jp
       * updates: centosd6.centos.org
      base                                                                                      | 3.7 kB     00:00     
      extras                                                                                    | 3.4 kB     00:00     
      updates                                                                                   | 3.4 kB     00:00     
      updates/primary_db                                                                        | 2.6 MB     00:02     
      Setting up Install Process
      Resolving Dependencies
      --> Running transaction check
      ---> Package php.x86_64 0:5.4.27-1.el6.remi will be installed
      --> Processing Dependency: php-cli(x86-64) = 5.4.27-1.el6.remi for package: php-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: httpd-mmn = 20051115 for package: php-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: httpd for package: php-5.4.27-1.el6.remi.x86_64
      ---> Package php-common.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package php-gd.x86_64 0:5.4.27-1.el6.remi will be installed
      --> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.27-1.el6.remi.x86_64
      ---> Package php-mbstring.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package php-mcrypt.x86_64 0:5.4.27-1.el6.remi will be installed
      --> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.4.27-1.el6.remi.x86_64
      ---> Package php-mysql.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package php-pdo.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package php-pear.noarch 1:1.9.4-23.el6.remi will be installed
      --> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-23.el6.remi.noarch
      ---> Package php-xml.x86_64 0:5.4.27-1.el6.remi will be installed
      --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.27-1.el6.remi.x86_64
      --> Running transaction check
      ---> Package httpd.x86_64 0:2.2.15-30.el6.centos will be installed
      --> Processing Dependency: httpd-tools = 2.2.15-30.el6.centos for package: httpd-2.2.15-30.el6.centos.x86_64
      --> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-30.el6.centos.x86_64
      --> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-30.el6.centos.x86_64
      --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-30.el6.centos.x86_64
      --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-30.el6.centos.x86_64
      ---> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed
      ---> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
      ---> Package libxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed
      ---> Package php-cli.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package php-process.x86_64 0:5.4.27-1.el6.remi will be installed
      ---> Package t1lib.x86_64 0:5.1.2-6.el6_2.1 will be installed
      --> Running transaction check
      ---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed
      ---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
      ---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
      ---> Package httpd-tools.x86_64 0:2.2.15-30.el6.centos will be installed
      ---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
      --> Finished Dependency Resolution
       
      Dependencies Resolved
       
      =================================================================================================================
       Package                     Arch                 Version                            Repository             Size
      =================================================================================================================
      Installing:
       php                         x86_64               5.4.27-1.el6.remi                  remi                  2.7 M
       php-common                  x86_64               5.4.27-1.el6.remi                  remi                  930 k
       php-gd                      x86_64               5.4.27-1.el6.remi                  remi                  143 k
       php-mbstring                x86_64               5.4.27-1.el6.remi                  remi                  944 k
       php-mcrypt                  x86_64               5.4.27-1.el6.remi                  remi                   51 k
       php-mysql                   x86_64               5.4.27-1.el6.remi                  remi                  136 k
       php-pdo                     x86_64               5.4.27-1.el6.remi                  remi                  120 k
       php-pear                    noarch               1:1.9.4-23.el6.remi                remi                  372 k
       php-xml                     x86_64               5.4.27-1.el6.remi                  remi                  171 k
      Installing for dependencies:
       apr                         x86_64               1.3.9-5.el6_2                      base                  123 k
       apr-util                    x86_64               1.3.9-3.el6_0.1                    base                   87 k
       apr-util-ldap               x86_64               1.3.9-3.el6_0.1                    base                   15 k
       httpd                       x86_64               2.2.15-30.el6.centos               updates               821 k
       httpd-tools                 x86_64               2.2.15-30.el6.centos               updates                73 k
       libXpm                      x86_64               3.5.10-2.el6                       base                   51 k
       libmcrypt                   x86_64               2.5.8-9.el6                        epel                   96 k
       libxslt                     x86_64               1.1.26-2.el6_3.1                   base                  452 k
       mailcap                     noarch               2.1.31-2.el6                       base                   27 k
       php-cli                     x86_64               5.4.27-1.el6.remi                  remi                  2.6 M
       php-process                 x86_64               5.4.27-1.el6.remi                  remi                   61 k
       t1lib                       x86_64               5.1.2-6.el6_2.1                    base                  160 k
       
      Transaction Summary
      =================================================================================================================
      Install      21 Package(s)
       
      Total download size: 10 M
      Installed size: 37 M
      Is this ok [y/N]: y
      Downloading Packages:
      (1/21): apr-1.3.9-5.el6_2.x86_64.rpm                                                      | 123 kB     00:00     
      (2/21): apr-util-1.3.9-3.el6_0.1.x86_64.rpm                                               |  87 kB     00:00     
      (3/21): apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm                                          |  15 kB     00:00     
      (4/21): httpd-2.2.15-30.el6.centos.x86_64.rpm                                             | 821 kB     00:01     
      (5/21): httpd-tools-2.2.15-30.el6.centos.x86_64.rpm                                       |  73 kB     00:00     
      (6/21): libXpm-3.5.10-2.el6.x86_64.rpm                                                    |  51 kB     00:00     
      (7/21): libmcrypt-2.5.8-9.el6.x86_64.rpm                                                  |  96 kB     00:00     
      (8/21): libxslt-1.1.26-2.el6_3.1.x86_64.rpm                                               | 452 kB     00:00     
      (9/21): mailcap-2.1.31-2.el6.noarch.rpm                                                   |  27 kB     00:00     
      (10/21): php-5.4.27-1.el6.remi.x86_64.rpm                                                 | 2.7 MB     00:01     
      (11/21): php-cli-5.4.27-1.el6.remi.x86_64.rpm                                             | 2.6 MB     00:01     
      (12/21): php-common-5.4.27-1.el6.remi.x86_64.rpm                                          | 930 kB     00:00     
      (13/21): php-gd-5.4.27-1.el6.remi.x86_64.rpm                                              | 143 kB     00:00     
      (14/21): php-mbstring-5.4.27-1.el6.remi.x86_64.rpm                                        | 944 kB     00:00     
      (15/21): php-mcrypt-5.4.27-1.el6.remi.x86_64.rpm                                          |  51 kB     00:00     
      (16/21): php-mysql-5.4.27-1.el6.remi.x86_64.rpm                                           | 136 kB     00:00     
      (17/21): php-pdo-5.4.27-1.el6.remi.x86_64.rpm                                             | 120 kB     00:00     
      (18/21): php-pear-1.9.4-23.el6.remi.noarch.rpm                                            | 372 kB     00:00     
      (19/21): php-process-5.4.27-1.el6.remi.x86_64.rpm                                         |  61 kB     00:00     
      (20/21): php-xml-5.4.27-1.el6.remi.x86_64.rpm                                             | 171 kB     00:00     
      (21/21): t1lib-5.1.2-6.el6_2.1.x86_64.rpm                                                 | 160 kB     00:00     
      -----------------------------------------------------------------------------------------------------------------
      Total                                                                            1.5 MB/s |  10 MB     00:06     
      Running rpm_check_debug
      Running Transaction Test
      Transaction Test Succeeded
      Running Transaction
        Installing : php-common-5.4.27-1.el6.remi.x86_64                                                          1/21 
       
      WARNING : These php-* RPM are not official Fedora / Red Hat build and
      overrides the official ones. Don't file bugs on Fedora Project nor Red Hat.
       
      Use dedicated forums http://forums.famillecollet.com/
       
        Installing : apr-1.3.9-5.el6_2.x86_64                                                                     2/21 
        Installing : apr-util-1.3.9-3.el6_0.1.x86_64                                                              3/21 
        Installing : php-cli-5.4.27-1.el6.remi.x86_64                                                             4/21 
        Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                                                         5/21 
        Installing : httpd-tools-2.2.15-30.el6.centos.x86_64                                                      6/21 
        Installing : php-pdo-5.4.27-1.el6.remi.x86_64                                                             7/21 
        Installing : php-process-5.4.27-1.el6.remi.x86_64                                                         8/21 
        Installing : libmcrypt-2.5.8-9.el6.x86_64                                                                 9/21 
        Installing : mailcap-2.1.31-2.el6.noarch                                                                 10/21 
        Installing : httpd-2.2.15-30.el6.centos.x86_64                                                           11/21 
        Installing : libxslt-1.1.26-2.el6_3.1.x86_64                                                             12/21 
        Installing : php-xml-5.4.27-1.el6.remi.x86_64                                                            13/21 
        Installing : libXpm-3.5.10-2.el6.x86_64                                                                  14/21 
        Installing : t1lib-5.1.2-6.el6_2.1.x86_64                                                                15/21 
        Installing : php-gd-5.4.27-1.el6.remi.x86_64                                                             16/21 
        Installing : 1:php-pear-1.9.4-23.el6.remi.noarch                                                         17/21 
        Installing : php-5.4.27-1.el6.remi.x86_64                                                                18/21 
        Installing : php-mcrypt-5.4.27-1.el6.remi.x86_64                                                         19/21 
        Installing : php-mysql-5.4.27-1.el6.remi.x86_64                                                          20/21 
        Installing : php-mbstring-5.4.27-1.el6.remi.x86_64                                                       21/21 
        Verifying  : apr-1.3.9-5.el6_2.x86_64                                                                     1/21 
        Verifying  : php-mbstring-5.4.27-1.el6.remi.x86_64                                                        2/21 
        Verifying  : php-mcrypt-5.4.27-1.el6.remi.x86_64                                                          3/21 
        Verifying  : php-cli-5.4.27-1.el6.remi.x86_64                                                             4/21 
        Verifying  : t1lib-5.1.2-6.el6_2.1.x86_64                                                                 5/21 
        Verifying  : php-gd-5.4.27-1.el6.remi.x86_64                                                              6/21 
        Verifying  : php-pdo-5.4.27-1.el6.remi.x86_64                                                             7/21 
        Verifying  : libXpm-3.5.10-2.el6.x86_64                                                                   8/21 
        Verifying  : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                                                         9/21 
        Verifying  : httpd-tools-2.2.15-30.el6.centos.x86_64                                                     10/21 
        Verifying  : php-5.4.27-1.el6.remi.x86_64                                                                11/21 
        Verifying  : httpd-2.2.15-30.el6.centos.x86_64                                                           12/21 
        Verifying  : apr-util-1.3.9-3.el6_0.1.x86_64                                                             13/21 
        Verifying  : php-process-5.4.27-1.el6.remi.x86_64                                                        14/21 
        Verifying  : php-mysql-5.4.27-1.el6.remi.x86_64                                                          15/21 
        Verifying  : libxslt-1.1.26-2.el6_3.1.x86_64                                                             16/21 
        Verifying  : mailcap-2.1.31-2.el6.noarch                                                                 17/21 
        Verifying  : php-xml-5.4.27-1.el6.remi.x86_64                                                            18/21 
        Verifying  : php-common-5.4.27-1.el6.remi.x86_64                                                         19/21 
        Verifying  : libmcrypt-2.5.8-9.el6.x86_64                                                                20/21 
        Verifying  : 1:php-pear-1.9.4-23.el6.remi.noarch                                                         21/21 
       
      Installed:
        php.x86_64 0:5.4.27-1.el6.remi                         php-common.x86_64 0:5.4.27-1.el6.remi                   
        php-gd.x86_64 0:5.4.27-1.el6.remi                      php-mbstring.x86_64 0:5.4.27-1.el6.remi                 
        php-mcrypt.x86_64 0:5.4.27-1.el6.remi                  php-mysql.x86_64 0:5.4.27-1.el6.remi                    
        php-pdo.x86_64 0:5.4.27-1.el6.remi                     php-pear.noarch 1:1.9.4-23.el6.remi                     
        php-xml.x86_64 0:5.4.27-1.el6.remi                    
       
      Dependency Installed:
        apr.x86_64 0:1.3.9-5.el6_2                                 apr-util.x86_64 0:1.3.9-3.el6_0.1                   
        apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1                     httpd.x86_64 0:2.2.15-30.el6.centos                 
        httpd-tools.x86_64 0:2.2.15-30.el6.centos                  libXpm.x86_64 0:3.5.10-2.el6                        
        libmcrypt.x86_64 0:2.5.8-9.el6                             libxslt.x86_64 0:1.1.26-2.el6_3.1                   
        mailcap.noarch 0:2.1.31-2.el6                              php-cli.x86_64 0:5.4.27-1.el6.remi                  
        php-process.x86_64 0:5.4.27-1.el6.remi                     t1lib.x86_64 0:5.1.2-6.el6_2.1                      
       
      Complete!


    • Apache의 시작과 종료 테스트
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      [root@centos ~]# service httpd start
      httpd (을)를 시작 중: httpd: apr_sockaddr_info_get() failed for centos.tanker
      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
      [  OK  ]
      [root@centos ~]# service httpd restart
      httpd 를 정지 중: [  OK  ]
      httpd (을)를 시작 중: httpd: apr_sockaddr_info_get() failed for centos.tanker
      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
      [  OK  ]
      [root@centos ~]# service httpd stop
      httpd 를 정지 중: [  OK  ]


    • Apache와 PHP 정상 동작 여부 확인
      1
      2
      3
      4
      5
      6
      [root@centos ~]# vi /var/www/html/info.php
       
      <?php
                 phpinfo();
      ?>
      ~

      http://Your's IP Addr/info.php 에 접속하여 아래와 같은 화면이 나오면 정상.


    • Virtual Host 설정 파일 추가
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      [root@centos ~]# cd /etc/httpd/conf.d
      [root@centos conf.d]# ls
      README  php.conf  welcome.conf
       
      [root@centos conf.d]# vi /etc/httpd/conf.d/tank_home.conf
       
      <VirtualHost *:80>
        ServerAdmin test@YourDomain.com
        DocumentRoot /data/www/tank_home
        ServerName YourDomain.com
       
        # Logging
        ErrorLog /var/log/httpd/YourDomain-error-log
        CustomLog /var/log/httpd/YourDomain-acces-log common
      </VirtualHost>
      ~
       
      [root@centos conf.d]# /etc/init.d/httpd restart
      httpd 를 정지 중: [  OK  ]
      httpd (을)를 시작 중: Warning: DocumentRoot [/data/www/tank_home] does not exist
      httpd: apr_sockaddr_info_get() failed for centos.tanker
      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
      [  OK  ]


      Apache 재시작 후 아래와 같은 화면이 보여지면, 정상 동작하는 것임.


    • 해킹에 악용될 수 있는 버전 정보를 감추기
      웹서버 버전 정보가 표시되지 않도록 함.
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      [root@centos ~]# vi /etc/httpd/conf/httpd.conf
       
      #
      Don't give away too much information about all the subcomponents
      # we are running.  Comment out this line if you don't mind remote sites
      # finding out what major optional modules you are running
      #ServerTokens OS
      ServerTokens Prod         --> 버전정보를 감추도록 설정함.
       
      #
      # Optionally add a line containing the server version and virtual host
      # name to server-generated pages (internal error documents, FTP directory
      # listings, mod_status and mod_info output etc., but not CGI generated
      # documents or custom error documents).
      # Set to "EMail" to also include a mailto: link to the ServerAdmin.
      # Set to one of:  On | Off | EMail
      #
      #ServerSignature On
      ServerSignature Off        --> 버전 정보가 보여지지 않도록 설정함.
       
       
      [root@centos ~]# vi /etc/php.ini
       
      ;;;;;;;;;;;;;;;;;
      ; Miscellaneous ;
      ;;;;;;;;;;;;;;;;;
       
      ; Decides whether PHP may expose the fact that it is installed on the server
      ; (e.g. by adding its signature to the Web server header).  It is no security
      ; threat in any way, but it makes it possible to determine whether you use PHP
      ; on your server or not.
      ; http://php.net/expose-php
      #expose_php = On
      expose_php = Off          --> 버전 정보가 보여지지 않도록 설정
       
       
      [root@centos ~]# /etc/init.d/httpd restart
      httpd 를 정지 중: [  OK  ]
      httpd (을)를 시작 중: httpd: apr_sockaddr_info_get() failed for centos.tanker
      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
      [  OK  ]


      설정하기 전과 이후 비교 이미지


    • CronLog 설치 및 설정
      CronLog 설치 : yum --enablerepo=epel,rpmforge,remi install cronolog.x86_64
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      [root@centos ~]# yum --enablerepo=epel,rpmforge,remi install cronolog.x86_64
      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
      Excluding mirror: data.nicehosting.co.kr
       * base: centos.mirror.cdnetworks.com
       * epel: mirror.premi.st
      Excluding mirror: data.nicehosting.co.kr
       * extras: centos.mirror.cdnetworks.com
       * remi: remi.kazukioishi.net
       * rpmforge: ftp.riken.jp
       * updates: centosd6.centos.org
      Setting up Install Process
      Resolving Dependencies
      --> Running transaction check
      ---> Package cronolog.x86_64 0:1.6.2-10.el6 will be installed
      --> Finished Dependency Resolution
       
      Dependencies Resolved
       
      ==================================================================================================
       Package                Arch                 Version                     Repository          Size
      ==================================================================================================
      Installing:
       cronolog               x86_64               1.6.2-10.el6                epel                34 k
       
      Transaction Summary
      ==================================================================================================
      Install       1 Package(s)
       
      Total download size: 34 k
      Installed size: 68 k
      Is this ok [y/N]: y
      Downloading Packages:
      cronolog-1.6.2-10.el6.x86_64.rpm                                           |  34 kB     00:00     
      Running rpm_check_debug
      Running Transaction Test
      Transaction Test Succeeded
      Running Transaction
        Installing : cronolog-1.6.2-10.el6.x86_64                                                   1/1 
        Verifying  : cronolog-1.6.2-10.el6.x86_64                                                   1/1 
       
      Installed:
        cronolog.x86_64 0:1.6.2-10.el6                                                                  
       
      Complete!


      설정 : httpd.conf 또는 virtual hosts conf 파일에 기존 custom log를 주석 처리하고 아래의 구문을 넣고, 재시작 후 확인.
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      [root@centos ~]# vi /etc/httpd/conf.d/tank_home.conf
       
      <VirtualHost *:80>
        ServerAdmin test@YourDomain.com
        DocumentRoot /data/www/tank_home
        ServerName YourDomain.com
       
        # Logging
        ErrorLog /var/log/httpd/YourDomain-error-log
        #CustomLog /var/log/httpd/YourDomain-acces-log common
        CustomLog "|/usr/sbin/cronolog /var/log/httpd/YourDomain-access_log.%Y%m%d" common
      </VirtualHost>
       
      [root@centos conf.d]# /etc/init.d/httpd restart
      httpd 를 정지 중: [  OK  ]
      httpd (을)를 시작 중: httpd: apr_sockaddr_info_get() failed for centos.tanker
      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
      [  OK  ]
       
      [root@centos conf.d]# ls /var/log/httpd
      YourDomain-access_log.20140408  access_log  YourDomain-acces-log
      YourDomain-error-log            error_log   


      유용한 설정의 예
      1
      2
      3
      4
      5
      6
      7
      일별로 로그 저장
      CustomLog "|/usr/sbin/cronolog /var/log/apache2/access_log_%Y%m%d" combined
      ErrorLog "|/usr/sbin/cronolog /var/log/apache2/error_log_%Y%m%d"
       
      월별로 로그 저장
      CustomLog "|/usr/sbin/cronolog /var/log/apache2/access_log_%Y%m" combined
      ErrorLog "|/usr/sbin/cronolog /var/log/apache2/error_log_%Y%m"

 

댓글0