메뉴 건너뛰기

Apache
2017.02.06 14:38

APM

조회 수 100 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

APM 최신 Stable 버전에 따라 소스 설치 작업 해 보았습니다.

복사&붙혀넣기 하실때 # 은 빼고 해주세요...^^

 

@ apache /usr/local/apache/
@ mariadb /usr/local/mariadb/
@ php /usr/local/php/
@ apache-log /logs/
@ db 파일 저장 위치 /usr/local/mariadb/data

@ 패키지 제거 및 설치
# rpm -qa httpd php mysql
# yum remove -y httpd php mysql
# yum -y install ORBit2 a2ps acpid alsa-lib aspell at atk audiofile audit-libs-python autoconf* autofs automake* avahi avahi-glib bc bind bind-chroot bind-libs bind-utils cairo ccid compat-libstdc++-33 conman cpp crash createrepo crypto-utils cryptsetup-luks cups-libs cvs cyrus-sasl-md5 cyrus-sasl-plain dbus-python device-mapper-multipath dhcp dhcp-devel dialog dmraid dos2unix dosfstools dump e2fsprogs-devel ed eject elfutils elfutils-libs enscript expat-devel expect expect-devel expectk fetchmail file finger flex fontconfig fontconfig-devel foomatic ftp gcc gcc-c++ gdb gdbm-devel gettext gfs2-utils glib2-devel glibc-devel glibc-headers gmp-devel gnutls gpm gtk2 hdparm hesiod hicolor-icon-theme imake iptraf iptstate ipvsadm irqbalance kernel-devel kernel-headers keyutils-libs-devel kpartx krb5-devel krb5-workstation ksh lftp libICE libSM libX11 libX11-devel libXau libXau-devel libXcursor libXdmcp libXdmcp-devel libXext libXfixes libXft libXi libXinerama libXpm libXpm-devel libXrandr libXrender libXt libXxf86vm libaio libaio-devel libart_lgpl libbonobo libcurl-devel libdaemon libevent libfontenc libgomp libhugetlbfs libhugetlbfs-devel libidn-devel libmng libnl libnl-devel libpcap libselinux-devel libselinux-python libsepol-devel libsmi libstdc++-devel libsysfs libtiff libtool libtool-ltdl libwvstreams libxml2-devel libxml2-python libxslt libxslt-python lksctp-tools logwatch lrzsz lsof m2crypto mailcap mailx make nasm man man-pages man-pages-ko mc mcstrans mdadm memtest86+ mesa-libGL mesa-libGL-devel mgetty microcode_ctl mkbootdisk mlocate mrtg mt-st mtools mtr mutt nc ncurses-devel net-snmp-libs netpbm nfs-utils nfs-utils-lib nmap nscd ntp ntsysv numactl oddjob openssh-clients openssl-devel pam-devel pam_krb5 pam_pkcs11 pango parted parted-devel patch pax pciutils pcsc-lite perl perl-Archive-Tar perl-Compress-Zlib perl-DBI perl-Digest-HMAC perl-Digest-SHA1 perl-HTML-Parser perl-HTML-Tagset perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-IO-Zlib perl-Net-SSLeay perl-Newt perl-Socket6 perl-String-CRC32 perl-URI perl-libwww-perl pkgconfig pm-utils postgresql-libs prelink procmail psacct psutils pulseaudio-esound-compat pyOpenSSL pykickstart pyorbit pyparted python-pyblock quota rdate rdist rmt rpcbind rpm-build rsh rsync rusers rwho samba samba-client samba-common sendmail sendmail-cf setools setserial setuptool shared-mime-info sip sos spamassassin squashfs-tools strace stunnel symlinks sysfsutils syslinux sysstat system-config-date system-config-firewall talk tcl tcp_wrappers tcpdump tcsh telnet telnet-server time tk tmpwatch traceroute tree ttmkfdir unix2dos unixODBC unzip usbutils usermode vim-common vim-enhanced vsftpd wget words xinetd xorg-x11-proto-devel yp-tools ypbind ypserv zip zlib-devel GConf2 ImageMagick ImageMagick-perl avahi-libs bwidget crda cryptsetup-luks-libs cups deltarpm desktop-file-utils device-mapper-multipath-libs dmidecode dmraid-events docbook-dtds flac foomatic-db foomatic-db-filesystem foomatic-db-ppds ghostscript ghostscript-fonts gnome-doc-utils-stylesheets gnome-python2 gnome-python2-canvas gnome-user-docs gnome-vfs2 gpm-libs groff-perl gstreamer gstreamer-tools html2ps hunspell iw jasper-libs kpathsea libIDL libX11-common libXcomposite libXdamage libXdamage-devel libXext-devel libXfixes-devel libXfont libXres libXtst libXxf86vm-devel libasyncns libcanberra libcanberra-gtk2 libcom_err-devel libcroco libdrm-devel libedit libglade2 libgnomecanvas libgsf libnetfilter_conntrack libnfnetlink libnotify libogg libpaper librsvg2 libsamplerate libsndfile libtalloc libtasn1 libtdb libthai libtirpc libusb1 libvorbis libwmf-lite libxcb libxcb-devel lm_sensors-libs mesa-dri-drivers mozilla-filesystem mpfr netpbm-progs ntpdate openjpeg-libs pcsc-lite-libs perl-Compress-Raw-Zlib perl-Crypt-OpenSSL-Bignum perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random perl-Date-Manip perl-Digest-SHA perl-Encode-Detect perl-ExtUtils-MakeMaker perl-ExtUtils-ParseXS perl-IO-Compress-Base perl-IO-Compress-Zlib perl-Mail-DKIM perl-MailTools perl-Module-Pluggable perl-Net-DNS perl-Net-LibIDN perl-NetAddr-IP perl-Package-Constants perl-Pod-Escapes perl-Pod-Simple perl-SNMP_Session perl-Test-Harness perl-Time-HiRes perl-TimeDate perl-YAML-Syck perl-devel perl-libs perl-version pixman poppler poppler-data poppler-utils portreserve psutils-perl pulseaudio pulseaudio-libs pycairo pygobject2 pygtk2 pygtk2-libglade python-decorator python-deltarpm python-slip python-slip-dbus rarian rarian-compat rtkit samba-winbind-clients setools-console setools-gui setools-libs setools-libs-tcl sgml-common sgpio sound-theme-freedesktop speex startup-notification system-config-date-docs system-config-firewall-tui tex-preview texinfo texinfo-tex texlive texlive-dvips texlive-latex texlive-texmf texlive-texmf-dvips texlive-texmf-fonts texlive-texmf-latex tokyocabinet urlview urw-fonts usermode-gtk xcb-util xml-common xorg-x11-font-utils xulrunner xz xz-lzma-compat yelp lksctp-tools-devel libtool-ltdl-devel gmp gdbm zlib curl openssl bzip2-devel bison system-config-securitylevel readline-devel cmake lynx php-snmp gd-devel glibc-* net-tools nano

 

@ 방화벽 설정
방화벽 정지
# systemctl mask firewalld
# systemctl stop firewalld
iptables 기본으로 사용할수 있게 설정
# systemctl enable iptables
iptables 서비스 시작
# systemctl start iptables
정상작동 확인
# iptables -nL


@ 기타 모듈 설치
# cd /usr/local/src
# mkdir etc
# cd etc
# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.6.2.tar.gz
# wget https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.1.tar.gz
# wget http://ijg.org/files/jpegsrc.v9b.tar.gz
# wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.21/libpng-1.6.21.tar.gz
# wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
# wget http://heanet.dl.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz


# tar zxvf freetype-2.6.2.tar.gz; tar zxvf libgd-2.1.1.tar.gz; tar zxvf jpegsrc.v9b.tar.gz; tar zxvf libpng-1.6.21.tar.gz; tar zxvf imap-2007f.tar.gz; tar zxvf pcre-8.38.tar.gz; tar zxvf libmcrypt-2.5.8.tar.gz; tar zxvf libiconv-1.14.tar.gz
# cd /usr/local/src/etc/jpeg-9b;./configure --prefix=/usr/local/jpeg --enable-shared --enable-static;make clean;make -j4; make install;
# cd /usr/local/src/etc/libpng-1.6.21
# cp scripts/makefile.linux Makefile
# make clean;make -j4;make install
# cd /usr/local/src/etc/freetype-2.6.2
# make clean;./configure --prefix=/usr/local/freetype;make -j4;make install
# cd /usr/local/src/etc/libgd-2.1.1
# make clean;./configure --prefix=/usr/local/gd;make -j4;make install
# cd /usr/local/src/etc/imap-2007f


Makefile을 오픈하여 EXTRACFLAGS= 를 EXTRACFLAGS=-fPIC 로 수정 합니다.


# make clean;make lr5
# mkdir /usr/local/imap
# mkdir /usr/local/imap/include
# mkdir /usr/local/imap/lib
# cp c-client/*.h /usr/local/imap/include/
# cp c-client/*.c /usr/local/imap/lib/
# cp c-client/c-client.a /usr/local/imap/lib/libc-client.a
# cp imapd/imapd /usr/sbin/

 

# vi /etc/xinetd.d/imapd
service imap
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/imapd
log_on_success += HOST DURATION
log_on_failure += HOST
}

 

# service xinetd restart
# cd /usr/local/src/etc/pcre-8.38
# make clean;./configure --prefix=/usr/local --enable-unicode-properties=yes;make -j4;make install
# cd /usr/local/src/etc/libmcrypt-2.5.8
# make clean;./configure --prefix=/usr/local;make -j4;make install
# cd /usr/local/src/etc/libiconv-1.14

 

/usr/local/src/etc/libiconv-1.14/srclib/stdio.in.h 파일 698줄을 다음과 같이
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#endif
+된 부분을 추가하여 수정한 후

 

# make clean;./configure --prefix=/usr/local;make -j4;
# make install
# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

vi /etc/sysconfig/selinux 를 열어
SELINUX=enforcing 를 SELINUX=disabled 로 바꿔주고
# /usr/sbin/setenforce 0 또는
# reboot 서버를 재부팅 한다.

@ 아파치 설치전 http2 설치
# cd /usr/local/src
# wget https://github.com/nghttp2/nghttp2/releases/download/v1.19.0/nghttp2-1.19.0.tar.gz
# tar -zxvf nghttp2-1.19.0.tar.gz
# cd nghttp2-1.19.0
# ./configure
# make;make install


@ 아파치 설치전 apr 설치
# cd /usr/local/src
# wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
# wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
# tar zxvf apr-1.5.2.tar.gz
# cd /usr/local/src/apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make;make install
# cd /usr/local/src
# tar zxvf apr-util-1.5.4.tar.gz
# cd /usr/local/src/apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make;make install


*** httpd 2.4.25 설치 ***
# cd /usr/local/src
# wget http://apache.tt.co.kr//httpd/httpd-2.4.25.tar.gz
# tar zxvf httpd-2.4.25.tar.gz
prefork 설정시
# vi /usr/local/src/httpd-2.4.25/server/mpm/prefork/prefork.c (73번 라인)
DEFAULT_SERVER_LIMIT의 상수값을 1024로 수정.
worker 설정시
# vi /usr/local/src/httpd-2.4.25/server/mpm/worker/worker.c (84번 라인)
DEFAULT_SERVER_LIMIT의 상수값을 64로 수정.
event 설정시
# vi /usr/local/src/httpd-2.4.25/server/mpm/event/event.c
DEFAULT_SERVER_LIMIT의 상수값을 64로 수정.

 

# cd httpd-2.4.25

#  ./configure \
--prefix=/usr/local/apache \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-z \
--with-pcre \
--enable-mods-static='vhost_alias log_config logio mime mime_magic alias headers status http negotiation' \
--enable-mods-shared='file_cache disk_cache deflate expires usertrack unique_id actions userdir autoindex cgi cache mem_cache distcache auth_digest rewrite remoteip' \
--enable-rewrite \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-cache \
--enable-ssl \
--disable-imagemap \
--disable-include \
--disable-charset-lite \
--disable-reqtimeout \
--disable-cgid \
--disable-asis \
--enable-so \
--enable-http2 \
--enable-authn-socache=no \
--enable-socache-shmcb \
--enable-socache-dbm=no \
--enable-ldap=no \
--enable-authnz-ldap=no \
--enable-cgid=no \
--enable-dav=no \
--enable-dav-fs=no \
--enable-isapi=no \
--enable-ext-filter=no \
--enable-authnz-ldap=no \
--enable-lbmethod-byrequests=no \
--enable-lbmethod-bytraffic=no \
--enable-lbmethod-bybusyness=no \
--enable-lbmethod-heartbeat=no \
--enable-dav-lock=no \
--enable-mpms-shared=all

 

# make;make install
httpd의 기본적으로 사용할 계정을 생성해 줍니다. 

 

# /usr/sbin/useradd -c "Apache" -u 48 -s /sbin/nologin -r -d /usr/local/apache/htdocs apache
그리고 나서 httpd.conf 파일을 다음과 같이 수정해 줍니다.

 

vim /usr/local/apache/conf/httpd.conf

User apache
Group apache 

 

'Loadable MPM'(–enable-mpms-shared=all) 으로 컴파일 되었기 때문에 자신이 사용할 MPM 모듈을 활성화 해줍니다.
LoadModule mpm_event_module modules/mod_mpm_event.so # event MPM
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so # prefork
#LoadModule mpm_worker_module modules/mod_mpm_worker.so # worker

 

그리고 ServerName 을 자신의 서버 환경에 맞게 적어줍니다.
ServerName localhost:80

서버관리자 메일주소 설정 

 

ServerAdmin webmaster@localhost

웹 페이지 접속시 기본적으로 읽어 들일 파일명 설정
DirectoryIndex index.html 를 찾아 DirectoryIndex index.html index.htm index.php index.php3 index.cgi index.jsp 로 수정

아래와 같이 추가 합니다. 

 

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .htm .html .php .ph php3 .php4 .phtml .inc -->추가
AddType application/x-httpd-php-source .phps -->추가

LoadModule php5_module modules/libphp5.so -->PHP 설치 후 없다면 추가

 

주석제거
# AddHandler cgi-script .cgi

 

몇가지 주석 및 제거 - 필요에 따라 더 적용해도 무방함
LoadModule userdir_module modules/mod_userdir.so <-- 주석제거
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so <-- 주석제거
LoadModule expires_module modules/mod_expires.so <-- 주석제거
LoadModule deflate_module modules/mod_deflate.so <-- 주석제거
Include conf/extra/httpd-mpm.conf <-- 주석제거
Include conf/extra/httpd-userdir.conf <-- 주석제거
Include conf/extra/httpd-vhosts.conf <-- 주석제거
Include conf/extra/httpd-default.conf <-- 주석제거

하단에 아래 구문 추가
<IfModule mod_deflate>
  AddType text/html .html .htm
  AddType text/css  .css
  AddType application/xml .xml
  AddType application/javascript  .js
  AddType application/x-httpd-php .php .php3 .html .htm .phtml .inc
  AddType application/x-httpd-php-source .phps

  AddOutputFilterByType DEFLATE text/plain text/html text/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml application/xml application/rss+xml
  AddOutputFilterByType DEFLATE text/css application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/php
  AddOutputFilterByType DEFLATE application/x-httpd-php
  AddOutputFilterByType DEFLATE application/x-httpd-fastphp

  DeflateCompressionLevel 9

  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

  SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|bmp|zip|tar|rar|alz|a00|ace|txt|mp3|mpe?g|wav|asf|wma|wmv|swf|exe|pdf|doc|xsl|hwp|java|c|t?gz|bz2|7z)$ no-gzip dont-vary
  Header append Vary User-Agent env=!dont-vary
</ifModule>
<IfModule mod_expires.c>
  ExpiresActive On

  ExpiresByType application/x-javascript "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/bmp "access plus 1 month"
  ExpiresByType image/cgm "access plus 1 month"
  ExpiresByType image/tiff "access plus 1 month"
  ExpiresByType video/mpeg "access plus 1 month"
  ExpiresByType video/quicktime "access plus 1 month"
  ExpiresByType video/x-msvideo "access plus 1 month"
  ExpiresByType audio/basic "access plus 1 month"
  ExpiresByType audio/midi "access plus 1 month"
  ExpiresByType audio/mpeg "access plus 1 month"
  ExpiresByType audio/x-aiff "access plus 1 month"
  ExpiresByType audio/x-mpegurl "access plus 1 month"
  ExpiresByType audio/x-pn-realaudio "access plus 1 month"
  ExpiresByType audio/x-wav  "access plus 1 month"
  ExpiresByType application/x-shockwave-flash  "access plus 1 month"
</IfModule>

인터넷주소 rewrite 모드 사용을 위한 설정
AllowOverride All <-- 수정
Require all denied

 

#vi /usr/local/apache/conf/extra/httpd-userdir.conf
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 를
Options MultiViews SymLinksIfOwnerMatch IncludesNoExec 로
Indexes 를 삭제 한다.

 

@ 접속이 안될경우 80포트 열어 주어야 한다.
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT =>추가
/etc/init.d/iptables restart 또는 service iptables restart 또는 systemctl start iptables.service
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

 

@ chkconfig를 이용해서 자동실행 등록해야 하지만 이전에 실행 스크립트 파일에 아래 내용 추가가 선행되어야 한다.
# vi /etc/init.d/httpd 

 

-httpd 파일
# chkconfig: 2345 90 90
# description: init file for Apache server daemon
# processname: /usr/local/apache/bin/apachectl
# config: /usr/local/apache/conf/httpd.conf
# pidfile: /usr/local/apache/logs/httpd.pid
이를 추가한다.
# chkconfig --add httpd
# chkconfig --list | grep httpd
# /etc/init.d/httpd start

 

*** mariaDB 다운로드 및 설치 ***
# cd /usr/local/src
# wget http://mirrors.accretive-networks.net/mariadb//mariadb-10.1.21/source/mariadb-10.1.21.tar.gz


# tar zxvf mariadb-10.1.21.tar.gz
# cd mariadb-10.1.21


# ln -s /usr/local/lib/libpcre.so.1 /lib64 또는 ln -s /usr/local/lib/libpcre.so.1 /lib


# cd BUILD
# sh autorun.sh
# cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mariadb/data \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system

 

# make;make install

 

* 사용자 등록
MariaDB 서버의 실행시킬 사용자를 생성한다.
# /usr/sbin/groupadd -g 27 -o -r mysql
# /usr/sbin/useradd -M -g mysql -o -r -d /usr/local/mariadb/data -s /bin/false -c "MariaDB Server" -u 27 mysql
※ 사용자를 mysql로 한것은 mariaDB는 MySQL과의 호환성으로 인하여 mysql로 하였습니다.


* 소유권 변경
# mkdir -p /usr/local/mariadb/InnoDB/redoLogs
# mkdir -p /usr/local/mariadb/InnoDB/undoLogs
# chown -R mysql /usr/local/mariadb/data
# chgrp -R mysql /usr/local/mariadb
# mkdir /usr/local/mariadb/logs /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/logs
# chown -R mysql:mysql /usr/local/mariadb/data


* 자동 실행 등록
# cp /usr/local/mariadb/support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list | grep mysqld

 

* 시스템 테이블 생성
# cd /usr/local/mariadb
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/data

 

* 라이브러리를 추가
# echo "/usr/local/mariadb/lib" > /etc/ld.so.conf.d/mysql.conf

 

* 64bit 라면 라이브러리를 위해서 심볼릭 링크
# cd /usr/local/mariadb
# ln -s lib lib64

# cd /usr/local/mariadb/support-files
# cp my-huge.cnf /etc/my.cnf
# chmod 755 /etc/init.d/mysqld
# /etc/init.d/mysqld start


※ 다른버전과 다르게 "character-set-server" 가 아닌 "character_set_server" 처럼 아래쪽라인 (_) 입니다.
이게 맞지 않을 경우 PID 에러라고 하면서 mysql이 실행되지 않을 수 있습니다.

 

* root 비밀번호 변경
# /usr/local/mariadb/bin/mysql -uroot -p
Enter password: (그냥 Enter 누르시면 됩니다.)
mysql> USE mysql;
mysql> UPDATE user SET password=password('패스워드') WHERE user='root';
mysql> FLUSH privileges;

 

* 캐릭터셋 확인
mysql> show variables like 'c%';


+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------------+
14 rows in set (0.00 sec)


설치 작업이 끝났다면 익명접근권한을 삭제하자. ( mysql 콘솔에 그냥 접근을 못하게 해야 함.)
# /usr/local/mariadb/bin/mysql -u root -p
# Enter password:
# mysql> USE mysql;
# mysql> delete from user where password = "";
# mysql> exit
# /usr/local/mariadb/bin/mysqladmin -u root -p reload
# Enter password:

 

*** PHP 7.0.15 설치 및 설정 ***

# cd /usr/local/src
# wget http://php.net/distributions/php-7.0.15.tar.gz
# tar zxvf php-7.0.15.tar.gz
# cd php-7.0.15

# ./configure --prefix=/usr/local/php \
--enable-fpm \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libdir=lib \
--with-gettext \
--with-mhash \
--with-gmp \
--with-gd \
--with-jpeg-dir=/usr/local/jpeg \
--with-png-dir=/usr/local/lib \
--with-mcrypt=/usr/local/lib \
--with-iconv=/usr/local/lib \
--with-freetype-dir=/usr/local/freetype \
--with-config-file-path=/usr/local/lib \
--with-zlib \
--enable-gd-native-ttf \
--enable-bcmath \
--enable-exif \
--with-mcrypt \
--with-zlib \
--with-bz2 \
--enable-mbstring \
--enable-opcache \
--with-curl \
--with-imap=/usr/local/imap \
--with-imap-ssl \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysqli=/usr/local/mariadb/bin/mysql_config \
--with-openssl \
--with-pdo-mysql=/usr/local/mariadb \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-libxml-dir=/usr \
--with-kerberos \
--disable-debug \
--enable-soap \
--with-gdbm \
--enable-ftp \
--enable-calendar \
--enable-shmop \
--enable-inline-optimization \
--enable-sigchild \
--enable-sockets \
--enable-maintainer-zts

# make; make install

* php.ini 파일을 다음과 같이 복사해 줍니다.

# cp php.ini-production /usr/local/lib/php.ini


추가작업은 아래와 같이

# vi /root/.bash_profile
PATH=$PATH:$HOME/bin 를
PATH=$PATH:$HOME/bin:/usr/local/mariadb/bin:/usr/local/apache/bin:/usr/local/php/bin 로 수정
source /root/.bash_profile
service httpd restart


@ php.ini 설정

# vi /usr/local/lib/php.ini
post_max_size = 100M
upload_max_filesize = 100M
allow_url_fopen = Off
short_open_tag = On
disable_functions = system,exec,passthru,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

자주 살펴보는 파일은 심볼릭 링크를 설정해서 /root/conf 파일에 모아두자
# mkdir /root/conf
# cd /root/conf
# ln -s /usr/local/lib/php.ini /root/conf/php.ini
# ln -s /usr/local/apache/conf/httpd.conf /root/conf/httpd.conf
# ln -s /usr/local/apache/conf/extra/httpd-vhosts.conf /root/conf/httpd-vhosts.conf
# ln -s /usr/local/apache/conf/extra/httpd-ssl.conf /root/conf/httpd-ssl.conf
# ln -s /etc/my.cnf /root/conf/my.cnf
# ln -s /etc/sysconfig/iptables /root/conf/iptables


@ Zendopcache 설치

 

php 5.5.x 버전 이상에서는 opcache 가 기본 내장되어 있으므로 php 설치시에 --enable-opcache 를 설정해주고 설치한 후
vi /usr/local/lib/php.ini 파일의 [opcache] 하단에 아래와 같이 설정해주고 service httpd restart 하면 적용 된다.

 

zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20151012/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1


@ ioncube_loaders 64비트 설치

*php7.1.x버전에는 아직 ioncube_loaders 적용이 불가 합니다.

# cd /usr/local/src
# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
# tar -zxvf ioncube_loaders_lin_x86-64.tar.gz
# cp /usr/local/src/ioncube/ioncube_loader_lin_7.0_ts.so /usr/local/php/lib/php/extensions/no-debug-zts-20151012/

php.ini 하단에 에 추가 [opcache] 맨 위에 extension 입력 

[opcache]
zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20151012/ioncube_loader_lin_7.0_ts.so
zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20151012/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1


만약 ioncube_loader 가 적용이 안되면
vi /etc/sysconfig/selinux 를 열어
SELINUX=enforcing 를 SELINUX=disabled 로 바꿔주고 서버 재부팅 한다..  

 

출처 : http://nanoomi.org


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
48 Apache APM 설치 apache 2.4 / php 5.5 / mariadb 10.0 맨하탄노숙자 2017.05.23 4
» Apache APM 맨하탄노숙자 2017.02.06 100
46 PHP How To Use Systemctl to Manage Systemd Services and Units 맨하탄노숙자 2016.07.19 43
45 PHP php-fpm systemctl 추가 맨하탄노숙자 2016.07.19 37
44 php gd-library 소스 경로 및 컴파일 옵션 맨하탄노숙자 2016.04.17 52
43 PHP PHP 5.2.17 컴파일시 오류 발생 file 맨하탄노숙자 2016.04.17 50
42 Apache 스토리지 웹서버 secret 맨하탄노숙자 2016.04.17 0
41 Apache Apache의 Worker / Prefork 방식의 차이점과 세팅 방법 맨하탄노숙자 2016.04.17 40
40 Apache [CENTOS] apache web server switching from prefork to worker MPM 맨하탄노숙자 2016.04.17 124
39 PHP PHP 4 Memcache 맨하탄노숙자 2016.03.06 80
38 NGINX nginx location 설정 맨하탄노숙자 2016.02.18 99
37 NGINX nginx 파일 공유 및 암호 설정하기 맨하탄노숙자 2016.02.18 209
36 NGINX nginx에서 동영상 스트리밍 서비스하기 맨하탄노숙자 2016.02.18 63
35 PHP PHP/cURL download progress monitoring 맨하탄노숙자 2016.02.15 46
34 PHP cURL download progress in PHP file 맨하탄노숙자 2016.02.15 109
33 이미지 다운로드시 다운로드 진행상황 표시 file 맨하탄노숙자 2016.02.15 86
32 PHP 파일 업로드 진행상황표시 file 맨하탄노숙자 2016.02.15 83
31 PHP 다운로드 구현 상태 (진행 상황 표시) 맨하탄노숙자 2016.02.15 70
30 PHP UTF-8 파일 다운로드 함수 맨하탄노숙자 2016.02.15 80
29 PHP down.php 다운로드 구현 맨하탄노숙자 2016.02.15 130
Board Pagination Prev 1 2 ... 3 Next
/ 3