1. 程式人生 > >centos下安裝nginx+apache+php+mysql

centos下安裝nginx+apache+php+mysql

1.安裝資訊

nginx               1.13.0

php                  5.6.38

mysql               5.7

2. 編譯安裝nginx

wget  http://nginx.org/download/nginx-1.13.0.tar.gz
mkdir /usr/local/nginx
tar -xf nginx-1.13.0.tar.gz 
##編譯安裝檢查
yum install pcre-devel openssl-devel -y
rpm -qa |egrep "pcre|openssl"
##新增nginx執行使用者
Useradd  -s /sbin/nologin -M www
cd nginx-1.13.0
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/run/nginx/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/client/ --http-proxy-temp-path=/usr/local/nginx/proxy/ --http-fastcgi-temp-path=/usr/local/nginx/fcgi/ --http-uwsgi-temp-path=/usr/local/nginx/uwsgi --http-scgi-temp-path=/usr/local/nginx/scgi --with-pcre --with-file-aio --with-http_image_filter_module 
echo $?   #檢查
make && make install 
ln -s /usr/local/nginx/sbin/nginx  /usr/bin
nginx 
lsof -i:80  #檢視

2. yum安裝apache

檢視是否安裝
rpm -qa httpd
安裝Apache
yum install httpd -y
安裝完成之後修改配置檔案指定服務具體目錄,從根目錄出發,修改配置資訊 ,具體見配置檔案
mysql資料庫配置在card-db01檔案中mysql連結資訊請注意修改

3. yum安裝php

安裝依賴包
yum -y install gcc gcc-c++ cmake make automake autoconf libtool patch perl \
unzip zlib zlib-devel bison bison-devel ncurses ncurses-devel libaio libaio-devel
檢查安裝包
yum list installed |grep php
新增epel源
yum install epel-release
rpm -ivh  http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
安裝php5.6.38
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-redis

yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
安裝完成
systemctl start php-fpm

4. yum安裝mysql配置主從

https://blog.csdn.net/wanchaopeng/article/details/80826148