CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14(2)

2019-08-02 01:31

basedir=/usr/local/mysql #MySQL程序安装路径

datadir=/data/mysql #MySQl数据库存放目录

:wq! #保存退出

service mysqld start #启动

vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行

export PATH=$PATH:/usr/local/mysql/bin

:wq! #保存退出

source /etc/profile #使配置立刻生效

下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

mkdir /var/lib/mysql #创建目录

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock #添加软链接

mysql_secure_installation #设置Mysql密码,根据提示按Y 回车输入2次密码

二、安装Nginx

1、安装pcre

cd /usr/local/src

mkdir /usr/local/pcre

tar zxvf pcre-8.35.tar.gz

cd pcre-8.35

./configure --prefix=/usr/local/pcre

make

make install

2、安装openssl

cd /usr/local/src

mkdir /usr/local/openssl

tar zxvf openssl-1.0.1h.tar.gz

cd openssl-1.0.1h

./config --prefix=/usr/local/openssl make

make install

vi /etc/profile

export PATH=$PATH:/usr/local/openssl/bin :wq!

source /etc/profile

3、安装zlib

cd /usr/local/src

mkdir /usr/local/zlib

tar zxvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure --prefix=/usr/local/zlib make

make install

4、安装Nginx

groupadd www

useradd -g www www -s /bin/false

cd /usr/local/src

tar zxvf nginx-1.6.0.tar.gz

cd nginx-1.6.0

./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 注意:--with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35指向的是源码包解压的路径,而不是安装的路径,否则会报错 make

make install

/usr/local/nginx/sbin/nginx #启动Nginx

设置nginx开机启动

vi /etc/rc.d/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: /usr/local/nginx/conf/nginx.conf

# pidfile: /usr/local/nginx/logs/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ \

nginx=\

prog=$(basename $nginx)

NGINX_CONF_FILE=\

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {

# make required directories

user=`$nginx -V 2>&1 | grep \'s/[^*]*--user=\\([^ ]*\\).*/\\1/g' -`

if [ -z \

useradd -M -s /bin/nologin $user

arguments:\sed

| fi

options=`$nginx -V 2>&1 | grep 'configure arguments:'`

for opt in $options; do

if [ `echo $opt | grep '.*-temp-path'` ]; then

value=`echo $opt | cut -d \

if [ ! -d \

# echo \

mkdir -p $value && chown -R $user $value fi fi done }

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

make_dirs

echo -n $\

daemon $nginx -c $NGINX_CONF_FILE

retval=$? echo

[ $retval -eq 0 ] && touch $lockfile

return $retval


CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:如何提高初中英语听力教学效率-精选作文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: