아 리 클 라 우 드 서버 centos 6.8 컴 파일 설치 nginx + mysql + php 환경
아 리 클 라 우 드 서버 시스템 버 전 은 centos 6.8, nginx - 1.8.1, mysql - 5.6.16, php - 5.6.31
nginx
설치 의존 패키지
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
nginx 다운로드 및 컴 파일
tar xvf nginx-1.8.1.tar.gzv
cd nginx-1.8.1.tar.gz
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx
make
make install
nginx 조작
시작:
/usr/local/nginx/sbin/nginx
닫 기: /usr/local/nginx/sbin/nginx -s stop
다시 시작: /usr/local/nginx/sbin/nginx -s reload
nginx 스 크 립 트vim /etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
killall -9 nginx
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
권한 증가:
chmod +x /etc/init.d/nginx
시동: chkconfig nginx on
2. MySQL설치 의존, 부분 은 nginx 를 설치 할 때 설치 한 적 이 있 습 니 다:
yum install gcc gcc-c++ ncurses-devel perl
cmake 설치
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar xvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make
make install
MySQL 사용자 와 그룹 설정
groupadd mysql
useradd -r -g mysql mysql
설치 디 렉 터 리 및 데이터베이스 파일 디 렉 터 리 만 들 기
mkdir -p /usr/local/mysql
mkdir -p /data/mysqldb
mysql 설치
tar xvf mysql-5.6.16.tar.gz
cd mysql-5.6.16.tar.gz
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1m -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
make
make install
디 렉 터 리 권한 수정
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /data/mysqldb
mysql 초기 화
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
프로필 복사cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
mysql 서비스 시작 스 크 립 트 복사 및 PATH 경로 추가
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
vim /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
source /etc/profile
프로필 수정
vim /etc/my.cnf
datadir = /data/mysqldb
my sql 을 열 고 시작 항목 을 추가 합 니 다.
service mysqld start
chkconfig mysqld on
보안 스 크 립 트 실행
/usr/local/mysql/bin/mysql_secure_installation
3. PHP1. 설치 의존, 부분 설치
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
암호 화 확장 라 이브 러 리 설치, libmcrypt - 2.5.8. tar. gz 다운로드 (http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/)
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
php 컴 파일, php - 5.6.31. tar. gz 다운로드 (http://cn2.php.net/downloads.php)
tar zxvf php-5.6.31.tar.gz
cd php-5.6.31
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
make
make install
php 프로필 복사
cp php.ini-development /usr/local/php/lib/php.in
php. ini 수정timezone = "Asia/Shanghai"
short_open_tag = On
session.save_path = "/tmp/session"
php - fpm 설정 복사
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
php - fpm 의 사용자 그룹 을 수정 합 니 다. nginx 와 같 습 니 다.php - fpm 시작 스 크 립 트 를 서비스 로 복사
cp php-5.6.31/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
php - fpm 를 열 고 부팅 항목 을 추가 합 니 다.service php-fpm start
chkconfig php-fpm on
nginx 지원 php 설정
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.confbak
vi /usr/local/nginx/conf/nginx.conf
1. server 에 있 는 php 의 주석 2. index 를 열 고 index. php 를 추가 합 니 다. 3. fastcgi 로 변경 합 니 다.param 1 행동:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
테스트vi /usr/local/nginx/html/index.php
브 라 우 저 입력 localhost / index. php
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.